다음을 통해 공유


iterator Struct

로 제대로 사용자 정의 반복기 클래스 작동 하는지 확인 하는 데는 빈 기본 구조체 iterator_traits.

template<class Category, class Type, class Distance = ptrdiff_t
    class Pointer = Type*, class Reference = Type&>
    struct iterator {
        typedef Category iterator_category;
        typedef Type value_type;
        typedef Distance difference_type;
        typedef Distance distance_type;
        typedef Pointer pointer;
        typedef Reference reference;
    };

설명

템플릿을 구조체는 기본 형식으로 모든 반복기에 대 한 역할을 합니다.멤버 형식 정의

  • iterator_category(템플릿 매개 변수에 대 한 동의어 Category).

  • value_type(템플릿 매개 변수에 대 한 동의어 형식).

  • difference_type(템플릿 매개 변수에 대 한 동의어 Distance).

  • distance_type(템플릿 매개 변수에 대 한 동의어 Distance)

  • pointer(템플릿 매개 변수에 대 한 동의어 Pointer).

  • reference(템플릿 매개 변수에 대 한 동의어 Reference).

참고 value_type 상수 형식이 있더라도 해서는 안 포인터 지점에서의 const 개체를 형식 참조의 const 개체를 지정 하 고 형식.

예제

참조 하십시오 iterator_traits 를 선언 하 고 반복기가 기본 클래스의 형식을 사용 하는 방법의 예입니다.

요구 사항

헤더: <iterator>

네임 스페이스: 국방 표준

참고 항목

참조

<iterator>

표준 C++ 라이브러리에서 스레드로부터의 안전성

표준 템플릿 라이브러리