list::reference

A type that provides a reference to an element stored in a list.

typedef typename Allocator::reference reference;

Example

// list_ref.cpp
// compile with: /EHsc
#include <list>
#include <iostream>

int main( ) 
{
   using namespace std;
   list <int> c1;
   
   c1.push_back( 10 );
   c1.push_back( 20 );

   int &i = c1.front( );
   int &j = c1.back( );
   cout << "The first element is " << i << endl;
   cout << "The second element is " << j << endl;
}

Output

The first element is 10
The second element is 20

Requirements

Header: <list>

Namespace: std

See Also

Concepts

list Class

list Class Members

Standard Template Library