名前空間
変種
操作

std::forward_list::erase_after

提供: cppreference.com

 
 
 
std::forward_list
メンバ関数
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
要素アクセスの循環参照を解除するために使用されている
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
イテレータ
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
容量
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
修飾子
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
操作
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) (C++11およびそれ以降)
iterator erase_after( const_iterator first, const_iterator last );
(2) (C++11およびそれ以降)
コンテナから指定された要素を削除します.
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)
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)
レンジ(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.

目次

[編集] パラメータ

pos -
削除する要素の前の要素を指すイテレータ
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 -
削除する要素の範囲
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.

[編集] 値を返します

1)
そのような要素が存在しない場合、消去された1、またはend()に続く要素を指すイテレータ.
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

[編集] 複雑

1)
定数.
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)
firstlast..間の距離の線形
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.

[編集]

#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

[編集] も参照してください

全ての要素を削除します
(パブリックメンバ関数) [edit]