std::vector::insert
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| iterator insert( iterator pos, const T& value ); iterator insert( const_iterator pos, const T& value ); |
(1) | (до C++11) (начиная с C++11) |
| iterator insert( const_iterator pos, T&& value ); |
(2) | (начиная с C++11) |
| void insert( iterator pos, size_type count, const T& value ); iterator insert( const_iterator pos, size_type count, const T& value ); |
(3) | (до C++11) (начиная с C++11) |
| template< class InputIt > void insert( iterator pos, InputIt first, InputIt last); |
(4) | (до C++11) (начиная с C++11) |
| iterator insert( const_iterator pos, std::initializer_list<T> ilist ); |
(5) | (начиная с C++11) |
You can help to correct and verify the translation. Click here for instructions.
value перед элементом, на который указывает posvalue before the element pointed to by posYou can help to correct and verify the translation. Click here for instructions.
count копии value перед элементом, на который указывает poscount copies of the value before the element pointed to by posYou can help to correct and verify the translation. Click here for instructions.
[first, last) перед элементом, на который указывает pos[first, last) before the element pointed to by posYou can help to correct and verify the translation. Click here for instructions.
ilist.ilist.You can help to correct and verify the translation. Click here for instructions.
Causes reallocation if the new size() is greater than the old capacity().If the new size() is greater than capacity(), all iterators and references are invalidated. Otherwise, only the iterators and references after the added element are invalidated.
Содержание |
[править] Параметры
| pos | - | Элемент, перед которым содержание будет вставлен
Original: element before which the content will be inserted The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| value | - | Значение элемента для вставки
Original: element value to insert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| first, last | - | диапазон элементов вставить, не может быть итераторов в контейнер, для которого вставка называется
Original: the range of elements to insert, can't be iterators into container for which insert is called The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| ilist | - | инициализатор список вставить значения из
Original: initializer list to insert the values from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| Требования, накладываемые на типы | ||
-InputIt должен соответствовать требованиям InputIterator.
| ||
[править] Возвращаемое значение
1-2)valuevalueYou can help to correct and verify the translation. Click here for instructions.
pos если count==0.pos if count==0.You can help to correct and verify the translation. Click here for instructions.
pos если first==last.pos if first==last.You can help to correct and verify the translation. Click here for instructions.
pos если ilist пусто.pos if ilist is empty.You can help to correct and verify the translation. Click here for instructions.
[править] Сложность
1-2) Constant plus linear in the distance between pos and end of the container.
3) Linear in count plus linear in the distance between pos and end of the container.
4) Linear in std::distance(first, last) plus linear in the distance between pos and end of the container.
5) Linear in ilist.size() plus linear in the distance between pos and end of the container.
[править] См. также
| (C++11) |
конструирует элемент "на месте" (public функция-член) |
| добавляет элементы в конец Original: adds elements to the end The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |