PIVector doc
This commit is contained in:
@@ -1433,11 +1433,15 @@ public:
|
||||
//! \~english Appends the given element `e` to the end of the array.
|
||||
//! \~russian Добавляет элемент `e` в конец массива.
|
||||
//! \~\details
|
||||
//! \~english If the new size() is greater than capacity()
|
||||
//! \~english If size() is less than capacity(), which is most often
|
||||
//! then the addition will be very fast, and does not depend on the size of the array.
|
||||
//! If the new size() is greater than capacity()
|
||||
//! then all iterators and references
|
||||
//! (including the past-the-end iterator) are invalidated.
|
||||
//! Otherwise only the past-the-end iterator is invalidated.
|
||||
//! \~russian Если новый size() больше, чем capacity(),
|
||||
//! \~russian Если size() меньше capacity(), что чаше всего,
|
||||
//! то добавление будет очень быстрым, и не зависит от размера массива.
|
||||
//! Если новый size() больше, чем capacity(),
|
||||
//! то все итераторы и указатели становятся нерабочими.
|
||||
//! В противном случае, все, кроме итераторов указывающих на конец массива,
|
||||
//! остаются в рабочем состоянии.
|
||||
@@ -1511,11 +1515,15 @@ public:
|
||||
//! \~english Appends the given element `e` to the end of the array.
|
||||
//! \~russian Добавляет элемент `e` в конец массива.
|
||||
//! \~\details
|
||||
//! \~english If the new size() is greater than capacity()
|
||||
//! \~english If size() is less than capacity(), which is most often
|
||||
//! then the addition will be very fast, and does not depend on the size of the array.
|
||||
//! If the new size() is greater than capacity()
|
||||
//! then all iterators and references
|
||||
//! (including the past-the-end iterator) are invalidated.
|
||||
//! Otherwise only the past-the-end iterator is invalidated.
|
||||
//! \~russian Если новый size() больше, чем capacity(),
|
||||
//! \~russian Если size() меньше capacity(), что чаше всего,
|
||||
//! то добавление будет очень быстрым, и не зависит от размера массива.
|
||||
//! Если новый size() больше, чем capacity(),
|
||||
//! то все итераторы и указатели становятся нерабочими.
|
||||
//! В противном случае, все, кроме итераторов указывающих на конец массива,
|
||||
//! остаются в рабочем состоянии.
|
||||
@@ -1556,6 +1564,11 @@ public:
|
||||
//! \~\details
|
||||
//! \~english Overloaded function.
|
||||
//! \~russian Перегруженая функция.
|
||||
//! \~\code
|
||||
//! PIVector<int> v{1, 2, 3};
|
||||
//! v.append(PIVector<int>{4, 5});
|
||||
//! piCout << v; // 1, 2, 3, 4, 5
|
||||
//! \endcode
|
||||
//! \~\sa \a append()
|
||||
inline PIVector<T> & append(const PIVector<T> & v) {return push_back(v);}
|
||||
|
||||
@@ -1595,11 +1608,97 @@ public:
|
||||
//! \~\sa \a append()
|
||||
inline PIVector<T> & operator <<(const PIVector<T> & v) {return push_back(v);}
|
||||
|
||||
inline PIVector<T> & push_front(const T & e) {insert(0, e); return *this;}
|
||||
inline PIVector<T> & push_front(T && e) {insert(0, std::move(e)); return *this;}
|
||||
inline PIVector<T> & push_front(const PIVector<T> & v) {insert(0, v); return *this;}
|
||||
//! \brief
|
||||
//! \~english Appends the given element `e` to the begin of the array.
|
||||
//! \~russian Добавляет элемент `e` в начало массива.
|
||||
//! \~\details
|
||||
//! \~english Adding an element to the beginning takes longer than to the end.
|
||||
//! This time is directly proportional to the size of the array.
|
||||
//! All iterators and references are invalidated.
|
||||
//! \~russian Добавление элемента в начало выполняется дольше чем в конец.
|
||||
//! Это время прямопропорционально размеру массива.
|
||||
//! При добавлении элемента все итераторы и указатели становятся нерабочими.
|
||||
//! \~\code
|
||||
//! PIVector<int> v{1, 2, 3};
|
||||
//! v.push_front(4);
|
||||
//! v.push_front(5);
|
||||
//! piCout << v; // 5, 4, 1, 2, 3
|
||||
//! \endcode
|
||||
//! \~\sa \a push_back(), \a append(), \a prepend(), \a insert()
|
||||
inline PIVector<T> & push_front(const T & e) {
|
||||
insert(0, e);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \brief
|
||||
//! \~english Appends the given element `e` to the begin of the array.
|
||||
//! \~russian Добавляет элемент `e` в начало массива.
|
||||
//! \~\details
|
||||
//! \~english Overloaded function.
|
||||
//! \~russian Перегруженая функция.
|
||||
//! \~\sa \a push_front()
|
||||
inline PIVector<T> & push_front(T && e) {
|
||||
insert(0, std::move(e));
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \brief
|
||||
//! \~english Appends the given array `v` to the begin of the array.
|
||||
//! \~russian Добавляет массив `v` в начало массива.
|
||||
//! \~\details
|
||||
//! \~english Overloaded function.
|
||||
//! \~russian Перегруженая функция.
|
||||
//! \~\code
|
||||
//! PIVector<int> v{1, 2, 3};
|
||||
//! v.push_front(PIVector<int>{4, 5});
|
||||
//! piCout << v; // 4, 5, 1, 2, 3
|
||||
//! \endcode
|
||||
//! \~\sa \a push_front()
|
||||
inline PIVector<T> & push_front(const PIVector<T> & v) {
|
||||
insert(0, v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! \brief
|
||||
//! \~english Appends the given element `e` to the begin of the array.
|
||||
//! \~russian Добавляет элемент `e` в начало массива.
|
||||
//! \~\details
|
||||
//! \~english Adding an element to the beginning takes longer than to the end.
|
||||
//! This time is directly proportional to the size of the array.
|
||||
//! All iterators and references are invalidated.
|
||||
//! \~russian Добавление элемента в начало выполняется дольше чем в конец.
|
||||
//! Это время прямопропорционально размеру массива.
|
||||
//! При добавлении элемента все итераторы и указатели становятся нерабочими.
|
||||
//! \~\code
|
||||
//! PIVector<int> v{1, 2, 3};
|
||||
//! v.prepend(4);
|
||||
//! v.prepend(5);
|
||||
//! piCout << v; // 5, 4, 1, 2, 3
|
||||
//! \endcode
|
||||
//! \~\sa \a append(), \a push_back(), \a push_front(), \a insert()
|
||||
inline PIVector<T> & prepend(const T & e) {return push_front(e);}
|
||||
|
||||
//! \brief
|
||||
//! \~english Appends the given element `e` to the begin of the array.
|
||||
//! \~russian Добавляет элемент `e` в начало массива.
|
||||
//! \~\details
|
||||
//! \~english Overloaded function.
|
||||
//! \~russian Перегруженая функция.
|
||||
//! \~\sa \a prepend()
|
||||
inline PIVector<T> & prepend(T && e) {return push_front(std::move(e));}
|
||||
|
||||
//! \brief
|
||||
//! \~english Appends the given array `v` to the begin of the array.
|
||||
//! \~russian Добавляет массив `v` в начало массива.
|
||||
//! \~\details
|
||||
//! \~english Overloaded function.
|
||||
//! \~russian Перегруженая функция.
|
||||
//! \~\code
|
||||
//! PIVector<int> v{1, 2, 3};
|
||||
//! v.prepend(PIVector<int>{4, 5});
|
||||
//! piCout << v; // 4, 5, 1, 2, 3
|
||||
//! \endcode
|
||||
//! \~\sa \a prepend()
|
||||
inline PIVector<T> & prepend(const PIVector<T> & v) {return push_front(v);}
|
||||
|
||||
inline PIVector<T> & pop_back() {
|
||||
@@ -1613,8 +1712,16 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline T take_back() {T e(back()); pop_back(); return e;}
|
||||
inline T take_front() {T e(front()); pop_front(); return e;}
|
||||
inline T take_back() {
|
||||
T e(back());
|
||||
pop_back();
|
||||
return e;
|
||||
}
|
||||
inline T take_front() {
|
||||
T e(front());
|
||||
pop_front();
|
||||
return e;
|
||||
}
|
||||
|
||||
template <typename ST>
|
||||
inline PIVector<ST> toType() const {
|
||||
@@ -1825,6 +1932,8 @@ private:
|
||||
|
||||
|
||||
#ifdef PIP_STD_IOSTREAM
|
||||
//! \~english Output operator to [std::ostream](https://en.cppreference.com/w/cpp/io/basic_ostream).
|
||||
//! \~russian Оператор вывода в [std::ostream](https://ru.cppreference.com/w/cpp/io/basic_ostream).
|
||||
template<typename T>
|
||||
inline std::ostream & operator <<(std::ostream & s, const PIVector<T> & v) {
|
||||
s << "{";
|
||||
@@ -1837,6 +1946,9 @@ inline std::ostream & operator <<(std::ostream & s, const PIVector<T> & v) {
|
||||
}
|
||||
#endif
|
||||
|
||||
//! \relatesalso PICout
|
||||
//! \~english Output operator to \a PICout
|
||||
//! \~russian Оператор вывода в \a PICout
|
||||
template<typename T>
|
||||
inline PICout operator <<(PICout s, const PIVector<T> & v) {
|
||||
s.space();
|
||||
@@ -1853,7 +1965,8 @@ inline PICout operator <<(PICout s, const PIVector<T> & v) {
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename T> inline void piSwap(PIVector<T> & f, PIVector<T> & s) {f.swap(s);}
|
||||
template<typename T>
|
||||
inline void piSwap(PIVector<T> & f, PIVector<T> & s) {f.swap(s);}
|
||||
|
||||
|
||||
#endif // PIVECTOR_H
|
||||
|
||||
Reference in New Issue
Block a user