Skip to content

Instantly share code, notes, and snippets.

@Jack2
Created November 27, 2012 15:43
Show Gist options
  • Save Jack2/4154927 to your computer and use it in GitHub Desktop.
Save Jack2/4154927 to your computer and use it in GitHub Desktop.
[C++]STL_list_example
#include <iostream>
#include <list>
using namespace std;
int main()
{
list<int> JL;
JL.push_back(100);
JL.push_front(999);
JL.push_back(200);
list<int>::iterator li;
for (li=JL.begin(); li!=JL.end(); ++li)
{
cout << *li << endl;
}
JL.clear();
JL.push_front(888);
for (li=JL.begin(); li!=JL.end(); ++li)
{
cout << *li << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment