English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C ++ The pop_front() function removes the first element from the list, so the size of the list will decrease by one.
The pop_front() function removes the first element, that is1.
void pop_front();
It does not contain any parameters.
It does not return any value.
Let's look at a simple example
#include <iostream> #include<list> using namespace std; int main() { list li={20,30,40,50}; li.pop_front(); list::iterator itr; for(itr=li.begin();itr!=li.end();++itr) cout<<*itr<<","; return 0; }
Output:
30,40,50
In this example, the pop_front() function removes the first element from the list, i.e., removes the element " 20.