std::deque<T,Allocator>:: pop_front
From cppreference.net
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
std::deque
| Member types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Deduction guides (C++17) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
void
pop_front
(
)
;
|
(C++26以降constexpr) | |
コンテナの最初の要素を削除します。
|
empty() が true の場合、動作は未定義です。 |
(C++26まで) |
|
empty() が true の場合:
|
(C++26以降) |
削除された要素へのイテレータと参照は無効化されます。もしその要素がコンテナの最後の要素である場合、
end()
イテレータも同様に無効化されます。その他の参照とイテレータは影響を受けません。
計算量
定数。
例
このコードを実行
#include <deque> #include <iostream> int main() { std::deque<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'
関連項目
|
末尾の要素を削除する
(公開メンバ関数) |
|
|
先頭に要素を挿入する
(公開メンバ関数) |
|
|
先頭の要素にアクセスする
(公開メンバ関数) |