i'm using stl list to do a simple inserting of a range of value into the list. The problem i have is that when i do a push_front i couldnt see the value when i did a displayed of my list, but when i did a count it show that i have the number of range but couldnt see my newly inserted value. Could someone explain to me wat happen?
int main()
{
list<int> myList;
myList.push_front(9);
myList.push_front(7);
myList.push_front(5);
myList.push_front(3);
myList.push_front(1);
list<int>::iterator p = myList.begin() ;
cout << "List initialised" <<endl;
myList.push_front(11);
myList.push_back(21);
cout << "List: " ;
while(p != myList.end())
{
cout << *p << " ";
p++;
}
cout <<endl;
cout << "Count: " << myList.size()<< endl;
}