std::forward_list::erase_after
De cppreference.com
< cpp | container | forward list
|
|
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 erase_after( const_iterator position ); |
(1) | (ya que C + +11) |
| iterator erase_after( const_iterator first, const_iterator last ); |
(2) | (ya que C + +11) |
Elimina los elementos especificados del contenedor .
1) Original:
Removes specified elements from the container.
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.
Elimina el
2) pos siguiente elemento .Original:
Removes the element following
pos.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.
Elimina los elementos en el rango
(first; last) .Original:
Removes the elements in the range
(first; last).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.
Contenido |
[editar] Parámetros
| pos | - | iterador al elemento anterior al elemento de eliminar
Original: iterator to the element preceding the element to remove The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| first, last | - | serie de elementos que desea eliminar
Original: range of elements to remove 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
1)iterador al elemento que sigue al borrado o
end() si ese elemento no existe .Original:
iterator to the element following the erased one, or
end() if no such element exists.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.
2) last
[editar] Complejidad
1)Constante .
2) Original:
Constant.
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.
lineal en distancia entre
first y last .Original:
linear in distance between
first and last.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] Ejemplo
#include <forward_list> #include <iterator> #include <iostream> int main() { std::forward_list<int> l = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; // l.erase( l.begin() ); // ERROR: No function erase l.erase_after( l.before_begin() ); // Removes first element for( auto n : l ) std::cout << n << " "; std::cout << '\n'; auto fi= std::next( l.begin() ); auto la= std::next( fi, 3 ); l.erase_after( fi, la ); for( auto n : l ) std::cout << n << " "; std::cout << '\n'; }
Output:
2 3 4 5 6 7 8 9 2 3 6 7 8 9
[editar] Ver también
| borra el contenido Original: clears the contents The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (miembro público función) | |