]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/iterator/doc/quickbook/archetypes.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / iterator / doc / quickbook / archetypes.qbk
CommitLineData
7c673cae
FG
1
2[section:archetypes Iterator Archetypes]
3
4The `iterator_archetype` class constructs a minimal implementation of
5one of the iterator access concepts and one of the iterator traversal concepts.
6This is used for doing a compile-time check to see if a the type requirements
7of a template are really enough to cover the implementation of the template.
8For further information see the documentation for the |concepts|_ library.
9
10[h2 Synopsis]
11
12 namespace iterator_archetypes
13 {
14 // Access categories
15
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;
21
22 }
23
24 template <
25 class Value
26 , class AccessCategory
27 , class TraversalCategory
28 >
29 class iterator_archetype
30 {
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;
36 };
37
38[h3 Access Category Tags]
39
40The access category types provided correspond to the following
41standard iterator access concept combinations:
42
43 readable_iterator_t :=
44
45 Readable Iterator
46
47 writable_iterator_t :=
48
49 Writeable Iterator
50
51 readable_writable_iterator_t :=
52
53 Readable Iterator & Writeable Iterator & Swappable Iterator
54
55 readable_lvalue_iterator_t :=
56
57 Readable Iterator & Lvalue Iterator
58
59 writeable_lvalue_iterator_t :=
60
61 Readable Iterator & Writeable Iterator & Swappable Iterator & Lvalue Iterator
62
63[h3 Traits]
64
65The nested trait types are defined as follows:
66
67
68 if (AccessCategory == readable_iterator_t)
69
70 value_type = Value
71 reference = Value
72 pointer = Value*
73
74 else if (AccessCategory == writable_iterator_t)
75
76 value_type = void
77 reference = void
78 pointer = void
79
80 else if (AccessCategory == readable_writable_iterator_t)
81
82 value_type = Value
83
84 reference :=
85
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
88 Value.
89
90 x = v
91
92 pointer = Value*
93
94 else if (AccessCategory == readable_lvalue_iterator_t)
95
96 value_type = Value
97 reference = Value const&
98 pointer = Value const*
99
100 else if (AccessCategory == writable_lvalue_iterator_t)
101
102 value_type = Value
103 reference = Value&
104 pointer = Value*
105
106 if ( TraversalCategory is convertible to forward_traversal_tag )
107
108 difference_type := ptrdiff_t
109
110 else
111
112 difference_type := unspecified type
113
114
115 iterator_category :=
116
117 A type X satisfying the following two constraints:
118
119 1. X is convertible to X1, and not to any more-derived
120 type, where X1 is defined by:
121
122 if (reference is a reference type
123 && TraversalCategory is convertible to forward_traversal_tag)
124 {
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
129 else
130 X1 = forward_iterator_tag
131 }
132 else
133 {
134 if (TraversalCategory is convertible to single_pass_traversal_tag
135 && reference != void)
136 X1 = input_iterator_tag
137 else
138 X1 = output_iterator_tag
139 }
140
141 2. X is convertible to TraversalCategory
142
143
144[h2 Requirements]
145
146The `AccessCategory` argument must be one of the predefined access
147category tags. The `TraversalCategory` must be one of the standard
148traversal tags. The `Value` type must satisfy the requirements of
149the iterator concept specified by `AccessCategory` and
150`TraversalCategory` as implied by the nested traits types.
151
152[h2 Concepts]
153
154`iterator_archetype` models the iterator concepts specified by the
155`AccessCategory` and `TraversalCategory`
156arguments. `iterator_archetype` does not model any other access
157concepts or any more derived traversal concepts.
158
159
160[endsect]