iterator 構造体
ユーザー定義の反復子クラスが 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 定数の型ではないことに注意してください。
使用例
反復子の基本クラスの型を宣言して使用する方法の例については、" iterator_traits を参照してください。
必要条件
ヘッダー: の<反復子>
名前空間: std