push_back

C++ Reference

push_back
Syntax:
  #include <list>
  void push_back( const TYPE& val );

The push_back() function appends val to the end of the list.

For example, the following code puts 10 integers into a list:

   list<int> the_list;
   for( int i = 0; i < 10; i++ )
     the_list.push_back( i );           

When displayed, the resulting list would look like this:

 0 1 2 3 4 5 6 7 8 9            

push_back() runs in constant time.

Related topics: