Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
An empty base struct used to ensure that a user-defined iterator class works properly with iterator_trait
s.
Syntax
struct iterator {
typedef Category iterator_category;
typedef Type value_type;
typedef Distance difference_type;
typedef Distance distance_type;
typedef Pointer pointer;
typedef Reference reference;
};
Remarks
The template struct serves as a base type for all iterators. It defines the member types
iterator_category
(a synonym for the template parameterCategory
).value_type
(a synonym for the template parameterType
).difference_type
(a synonym for the template parameterDistance
).distance_type
(a synonym for the template parameterDistance
)pointer
(a synonym for the template parameterPointer
).reference
(a synonym for the template parameterReference
).
Note that value_type
should not be a constant type even if pointer
points at an object of const
Type
and reference designates an object of const
Type
.
Example
See iterator_traits for an example of how to declare and use the types in the iterator base class.
Requirements
Header: <iterator>
Namespace: std
See also
<iterator>
Thread Safety in the C++ Standard Library
C++ Standard Library Reference