std::vector::emplace
Da cppreference.com
![]() |
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. |
template< class... Args > iterator emplace( const_iterator pos, Args&&... args ); |
(desde C++11) | |
Insere um novo elemento para o recipiente diretamente antes
pos
. O elemento é construído no local, ou seja, nenhuma cópia ou operações de movimentação são executadas. O construtor do elemento é chamado com o std::forward<Args>(args)... argumentos. O tipo de elemento deve ser 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.
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.
Índice |
[editar] Parâmetros
pos | - | iterador antes que o novo elemento será construído
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 | - | argumentos para encaminhar para o construtor do elemento
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. |
[editar] Valor de retorno
Iterador apontando para o elemento colocadas.
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.
You can help to correct and verify the translation. Click here for instructions.
[editar] Complexidade
Linear in the distance between pos
and end of the container.
[editar] Exceções
Se uma exceção é lançada (por exemplo, pelo construtor), o contêiner é deixado inalterado, tal como se esta função nunca foi chamado (garantia exceção forte).
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.
You can help to correct and verify the translation. Click here for instructions.
[editar] Veja também
insere elementos 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. (função pública membro) |