I want put a value from front of the list into an another list but I am getting an error.
for exmaple
List<int> li;
List<int> li2;
.............
.............
li2.push_back(li.front()); // this statement doesnt work for me.
Can someone please help me.
example code:
list<int> li;
list<int> li2;
li.push_back(1);
li.push_back(2);
li.push_back(3);
for(int i=0;i<3;i++)
{
cout<<li.front()<<endl;
li2.push_back(li.pop_front());
}