std::forward_list<T,Allocator>:: pop_front
From ja.cppreference.net
<
cpp
|
container
|
forward list
|
void
pop_front
(
)
;
|
(C++11以降)
(constexpr C++26以降) |
|
コンテナの最初の要素を削除します。
|
empty() が true の場合、動作は未定義です。 |
(C++26まで) |
|
empty() が true の場合:
|
(C++26以降) |
削除された要素への参照とイテレータは無効化されます。
計算量
定数。
例
このコードを実行
#include <forward_list> #include <iostream> int main() { std::forward_list<char> chars{'A', 'B', 'C', 'D'}; for (; !chars.empty(); chars.pop_front()) std::cout << "chars.front(): '" << chars.front() << "'\n"; }
出力:
chars.front(): 'A' chars.front(): 'B' chars.front(): 'C' chars.front(): 'D'
関連項目
|
先頭に要素を挿入する
(公開メンバ関数) |
|
|
最初の要素にアクセスする
(公開メンバ関数) |