deque::begin

첫 번째 요소는 있지 않은 deque에 주소를 지정 하는 반복기를 반환 합니다.

const_iterator begin( ) const; 
iterator begin( );

반환 값

주소는 비어 있지 않은 deque 이후 위치에 있지 않은 deque의 첫 번째 요소를 하는 임의 액세스 반복기입니다.

설명

경우 반환 값의 시작 배정은 const_iterator, 있지 않은 deque 개체를 수정할 수 없습니다.경우 반환 값의 시작 배정은 반복기, 있지 않은 deque 개체를 수정할 수 있습니다.

예제

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

int main( ) 
{
   using namespace std;
   deque <int> c1;
   deque <int>::iterator c1_Iter;
   deque <int>::const_iterator c1_cIter;
   
   c1.push_back( 1 );
   c1.push_back( 2 );

   c1_Iter = c1.begin( );
   cout << "The first element of c1 is " << *c1_Iter << endl;

   *c1_Iter = 20;
   c1_Iter = c1.begin( );
   cout << "The first element of c1 is now " << *c1_Iter << endl;

   // The following line would be an error because iterator is const
   // *c1_cIter = 200;
}
  

요구 사항

헤더: <deque>

네임 스페이스: std

참고 항목

참조

deque Class

deque::begin 및 deque::end

표준 템플릿 라이브러리