Bagikan melalui


front_insert_iterator::reference

A type that provides a reference to an element in a sequence controlled by the associated container.

typedef typename Container::reference reference;

Example

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

int main( )
{
   using namespace std;

   list<int> L;
   front_insert_iterator<list<int> > fiivIter( L );
   *fiivIter = 10;
   *fiivIter = 20;
   *fiivIter = 30;
   
   list<int>::iterator LIter;
   cout << "The list L is: ( ";
   for ( LIter = L.begin ( ) ; LIter != L.end ( ); LIter+)
      cout << *LIter << " ";
   cout << ")." << endl;

   front_insert_iterator<list<int> >::reference 
        RefFirst = *(L.begin ( ));
   cout << "The first element in the list L is: " 
        << RefFirst << "." << endl;
}

The list L is: ( 30 20 10 ). The first element in the list L is: 30.

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

front_insert_iterator Class

Standard Template Library

Other Resources

front_insert_iterator Members