다음을 통해 공유


deque::push_back

Adds an element to the end of the deque.

void push_back(
   const Type& _Val
);
void push_back(
   Type&& _Val
);

매개 변수

Parameter

설명

_Val

The element added to the end of the deque.

설명

If an exception is thrown, the deque is left unaltered and the exception is rethrown.

코드 예제

// deque_push_back.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>

int main( ) 
{
   using namespace std;
   deque <int> d;
   
   d.push_back( 1 );
   d.push_back( 2 );
   d.push_back( 3 );
   for( deque<int>::const_iterator i = d.begin(); i != d.end(); ++i )
   {
      cout << *i << " ";
   }
   cout << endl;

   d.push_front( 0 );
   d.push_back( 4 );
   for( deque<int>::const_iterator i = d.begin(); i != d.end(); ++i )
   {
      cout << *i << " ";
   }
   cout << endl;

// move initialize a deque of deques by moving d
   deque < deque <int> > dd;

   dd.push_back( move( d ) );
   cout << "Moved last element: " << dd[0].back( ) << endl;
}

Output

1 2 3
0 1 2 3 4
Moved last element: 4

요구 사항

헤더: <deque>

네임스페이스: std

참고 항목

참조

deque 클래스

deque::push_back 및 deque::pop_back

표준 템플릿 라이브러리