Namensräume
Varianten
Aktionen

std::forward_list::erase_after

Aus cppreference.com

 
 
 
std::forward_list
Member-Funktionen
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.
forward_list::forward_list
forward_list::~forward_list
forward_list::operator=
forward_list::assign
forward_list::get_allocator
Elementzugriff zerstört
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.
forward_list::front
Iteratoren
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::before_begin
forward_list::cbefore_begin
forward_list::begin
forward_list::cbegin
forward_list::end
forward_list::cend
Kapazität
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::empty
forward_list::max_size
Modifiers
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::clear
forward_list::insert_after
forward_list::emplace_after
forward_list::erase_after
forward_list::push_front
forward_list::emplace_front
forward_list::pop_front
forward_list::resize
forward_list::swap
Operations
Original:
Operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
forward_list::merge
forward_list::splice_after
forward_list::remove
forward_list::remove_if
forward_list::reverse
forward_list::unique
forward_list::sort
 
iterator erase_after( const_iterator position );
(1) (seit C++11)
iterator erase_after( const_iterator first, const_iterator last );
(2) (seit C++11)
Entfernt den angegebenen Elemente aus dem Container .
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.
1)
Entfernt das Element folgende pos .
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.
2)
Entfernt die Elemente im Bereich (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.

Inhaltsverzeichnis

[Bearbeiten] Parameter

pos -
Iterator auf das Element vor dem zu entfernenden Elements
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 -
Bereichs von Elementen zu entfernen
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.

[Bearbeiten] Rückgabewert

1)
Iterator auf das Element nach dem gelöschten ein oder end(), wenn kein solches Element vorhanden .
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.

2) last

[Bearbeiten] Komplexität

1)
Constant .
Original:
Constant.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
linear in Abstand zwischen first und 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.

[Bearbeiten] Beispiel

#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

[Bearbeiten] Siehe auch

löscht den Inhalt
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.

(öffentliche Elementfunktion) [edit]