std::forward_list<T,Allocator>::pop_front
From cppreference.com
< cpp | container | forward list
| void pop_front(); |
(C++11以降) | |
コンテナの最初の要素を削除します。コンテナに要素がない場合、未定義の動作となります。
削除された要素への参照およびイテレータは無効になります。
[編集] 計算量
定数。
[編集] 例
このコードを実行
#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'
[編集] 関連項目
| 先頭に要素を挿入する (公開メンバ関数) | |
| 最初の要素にアクセスする (public メンバ関数) |