Udostępnij za pośrednictwem


front_insert_iterator::operator=

Assignment operator used to implement the output iterator expression *i = x.

front_insert_iterator<Container>& operator=(
   typename Container::const_reference _Val
);

Parameters

  • _Val
    The value to be assigned to the element.

Return Value

A reference to the last element inserted at the front of the container.

Remarks

The member function evaluates container.push_front(_Val).

Example

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

int main( )
{
   using namespace std;

   list<int> L1;
   front_insert_iterator<list<int> > iter ( L1 );
   *iter = 10;
   iter++;
   *iter = 20;
   iter++;
   *iter = 30;
   iter++;

   list <int>::iterator vIter;
   cout << "The list L1 is: ( ";
   for ( vIter = L1.begin ( ) ; vIter != L1.end ( ); vIter++ )
      cout << *vIter << " ";
   cout << ")." << endl;
}

The list L1 is: ( 30 20 10 ).

Requirements

Header: <iterator>

Namespace: std

See Also

Reference

front_insert_iterator Class

Standard Template Library

Other Resources

front_insert_iterator Members