다음을 통해 공유


front_insert_iterator::operator=

Appends (pushes) a value onto the front of the container.

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

매개 변수

  • _Val
    The value to be assigned to the container.

반환 값

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

설명

The first member operator evaluates container.push_front(_Val), then returns *this.

The second member operator evaluates

container->push_front((typename Container::value_type&&)_Val),

then returns *this.

예제

// 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;
}
  

요구 사항

헤더: <iterator>

네임스페이스: std

참고 항목

참조

front_insert_iterator 클래스

표준 템플릿 라이브러리