deque::begin 및 deque::end
사용 하는 방법을 보여 줍니다 있는 deque::begin 및 deque::end Visual C++에서 표준 템플릿 라이브러리 (STL) 함수입니다.
const_iterator begin( ) const;
iterator begin( );
const_iterator end( ) const;
iterator end( );
설명
[!참고]
프로토타입에 클래스/매개 변수 이름은 헤더 파일에서 버전이 일치 하지 않습니다.일부 가독성을 높이기 위해 수정 되었습니다.
해당 시작 멤버 함수 시퀀스 또는 빈 시퀀스의 끝 바로 뒤의 첫 번째 요소를 가리키는 임의 액세스 반복기를 반환 합니다.해당 최종 멤버 함수는 시퀀스의 끝 바로 뒤를 가리키는 임의 액세스 반복기를 반환 합니다.
예제
// begin.cpp
// compile with: /EHsc
//
// Functions:
//
// begin()
// end()
#include <iostream>
#include <deque>
using namespace std;
typedef deque<int > INTDEQUE;
int main()
{
// Create A and fill it with elements 1,2,3,4 and 5
// using push_back function
INTDEQUE A;
A.push_back(1);
A.push_back(2);
A.push_back(3);
A.push_back(4);
A.push_back(5);
// Print the contents of A using iterator
// and functions begin() and end()
INTDEQUE::iterator pi;
for(pi= A.begin(); pi !=A.end(); pi++)
{
cout << *pi <<" " ;
}
cout<<endl;
}
Output
1 2 3 4 5
요구 사항
헤더: <deque>