2 [section:archetypes Iterator Archetypes]
4 The `iterator_archetype` class constructs a minimal implementation of
5 one of the iterator access concepts and one of the iterator traversal concepts.
6 This is used for doing a compile-time check to see if a the type requirements
7 of a template are really enough to cover the implementation of the template.
8 For further information see the documentation for the |concepts|_ library.
12 namespace iterator_archetypes
16 typedef /*implementation defined*/ readable_iterator_t;
17 typedef /*implementation defined*/ writable_iterator_t;
18 typedef /*implementation defined*/ readable_writable_iterator_t;
19 typedef /*implementation defined*/ readable_lvalue_iterator_t;
20 typedef /*implementation defined*/ writable_lvalue_iterator_t;
26 , class AccessCategory
27 , class TraversalCategory
29 class iterator_archetype
31 typedef /* see below */ value_type;
32 typedef /* see below */ reference;
33 typedef /* see below */ pointer;
34 typedef /* see below */ difference_type;
35 typedef /* see below */ iterator_category;
38 [h3 Access Category Tags]
40 The access category types provided correspond to the following
41 standard iterator access concept combinations:
43 readable_iterator_t :=
47 writable_iterator_t :=
51 readable_writable_iterator_t :=
53 Readable Iterator & Writeable Iterator & Swappable Iterator
55 readable_lvalue_iterator_t :=
57 Readable Iterator & Lvalue Iterator
59 writeable_lvalue_iterator_t :=
61 Readable Iterator & Writeable Iterator & Swappable Iterator & Lvalue Iterator
65 The nested trait types are defined as follows:
68 if (AccessCategory == readable_iterator_t)
74 else if (AccessCategory == writable_iterator_t)
80 else if (AccessCategory == readable_writable_iterator_t)
86 A type X that is convertible to Value for which the following
87 expression is valid. Given an object x of type X and v of type
94 else if (AccessCategory == readable_lvalue_iterator_t)
97 reference = Value const&
98 pointer = Value const*
100 else if (AccessCategory == writable_lvalue_iterator_t)
106 if ( TraversalCategory is convertible to forward_traversal_tag )
108 difference_type := ptrdiff_t
112 difference_type := unspecified type
117 A type X satisfying the following two constraints:
119 1. X is convertible to X1, and not to any more-derived
120 type, where X1 is defined by:
122 if (reference is a reference type
123 && TraversalCategory is convertible to forward_traversal_tag)
125 if (TraversalCategory is convertible to random_access_traversal_tag)
126 X1 = random_access_iterator_tag
127 else if (TraversalCategory is convertible to bidirectional_traversal_tag)
128 X1 = bidirectional_iterator_tag
130 X1 = forward_iterator_tag
134 if (TraversalCategory is convertible to single_pass_traversal_tag
135 && reference != void)
136 X1 = input_iterator_tag
138 X1 = output_iterator_tag
141 2. X is convertible to TraversalCategory
146 The `AccessCategory` argument must be one of the predefined access
147 category tags. The `TraversalCategory` must be one of the standard
148 traversal tags. The `Value` type must satisfy the requirements of
149 the iterator concept specified by `AccessCategory` and
150 `TraversalCategory` as implied by the nested traits types.
154 `iterator_archetype` models the iterator concepts specified by the
155 `AccessCategory` and `TraversalCategory`
156 arguments. `iterator_archetype` does not model any other access
157 concepts or any more derived traversal concepts.