다음을 통해 공유


array::cbegin

Const 임의 액세스 반복기는 컨테이너의 첫 번째 요소를 반환합니다.

const_iterator cbegin() const;

반환 값

주소에서 첫 번째 요소는 const 임의 액세스 반복기는 array Class (TR1) 또는 이후 빈 위치 array.항상 함께 반환 값을 비교 해야 array::cend 또는 array::end 가 올바른지 확인 합니다.

설명

반환 값의 array::cbegin, array 개체를 수정할 수 없습니다.

예제

// array_cbegin.cpp
// compile with: /EHsc
#include <array>
#include <iostream>

int main()
{
    using namespace std;
    array<int, 2> c1 = {1, 2};
    array<int, 2>::const_iterator c1_Iter;

    cout << "The array c1 contains elements:";
    c1_Iter = c1.cbegin();
    for (; c1_Iter != c1.cend(); c1_Iter++)
    {
        cout << " " << *c1_Iter;
    }
    cout << endl;

    // The following line would be an error because iterator is const
    // *c1.cbegin() = 200;
}
  

요구 사항

헤더: <array>

네임 스페이스: std

참고 항목

참조

<array>

array Class (TR1)

표준 템플릿 라이브러리