Пространства имён
Варианты
Действия

std::vector::emplace

Материал из cppreference.com

 
 
 
std::vector
Член функций
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
vector::vector
vector::~vector
vector::operator=
vector::assign
vector::get_allocator
Элемент доступа
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
vector::at
vector::operator[]
vector::front
vector::back
vector::data(C++11)
Итераторы
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
vector::begin
vector::cbegin

(C++11)
vector::end
vector::cend

(C++11)
vector::rbegin
vector::crbegin

(C++11)
vector::rend
vector::crend

(C++11)
Потенциала
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
vector::empty
vector::size
vector::max_size
vector::reserve
vector::capacity
vector::shrink_to_fit(C++11)
Модификаторы
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
vector::clear
vector::insert
vector::emplace(C++11)
vector::erase
vector::push_back
vector::emplace_back(C++11)
vector::pop_back
vector::resize
vector::swap
 
template< class... Args >
iterator emplace( const_iterator pos, Args&&... args );
(начиная с C++11)
Вставляет новый элемент в контейнере непосредственно перед pos. Элемент построен на месте, т.е. не копировать или перемещать операции. Конструктор элемента вызывается с std::forward<Args>(args)... аргументы. Тип элемента должно быть EmplaceConstructible, MoveInsertable and MoveAssignable.
Original:
Inserts a new element into the container directly before pos. The element is constructed in-place, i.e. no copy or move operations are performed. The constructor of the element is called with the arguments std::forward<Args>(args).... The element type must be EmplaceConstructible, MoveInsertable and MoveAssignable.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

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:
iterator before which the new element will be constructed
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
args -
Аргументы направить в конструкторе элемента
Original:
arguments to forward to the constructor of the element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Возвращаемое значение

Итератор, указывающий на элемент заложенных.
Original:
Iterator pointing to the emplaced element.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Сложность

Linear in the distance between pos and end of the container.

[править] Исключения

Если исключение (например, в конструкторе), контейнер остается без изменений, как если бы эта функция никогда не называли (сильная гарантия исключением).
Original:
If an exception is thrown (e.g. by the constructor), the container is left unmodified, as if this function was never called (strong exception guarantee).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] См. также

вставки элементов
Original:
inserts elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(public функция-член) [edit]