STL Implementation: List


/* STL Implementation : List
Author : Tausiq
B.Sc in CTE (Studying)
United International University
*/

#include
#include using namespace std;

list L;
list :: iterator i;
list :: reverse_iterator r;

void show ()
{
for ( i = L.begin (); i != L.end (); i++ )
cout << *i << ' '; cout << endl; } int main () { L.push_back ('a'); L.push_back ('b'); L.push_back ('c'); L.push_back ('b'); L.push_back ('a'); // a b c b a cout << "Initial List: " << endl; show (); // a b c b a L.sort (); show (); // a a b b c L.remove ('b'); // 'b' will be removed show (); // a a c L.unique (); // makes a unique list show (); // a c return 0; } [/sourcecode]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s