concepts.qbk
8.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
[/
/ Copyright (c) 2008 Eric Niebler
/
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/]
[section Concepts]
[h2 CharT requirements]
If type `BidiIterT` is used as a template argument to _basic_regex_, then `CharT` is
`iterator_traits<BidiIterT>::value_type`. Type `CharT` must have a trivial default
constructor, copy constructor, assignment operator, and destructor. In addition
the following requirements must be met for objects; `c` of type `CharT`, `c1` and `c2` of
type `CharT const`, and `i` of type `int`:
[table CharT Requirements
[
[[*Expression]]
[[*Return type]]
[[*Assertion / Note / Pre- / Post-condition]]
]
[
[`CharT c`]
[`CharT`]
[Default constructor (must be trivial).]
]
[
[`CharT c(c1)`]
[`CharT`]
[Copy constructor (must be trivial).]
]
[
[`c1 = c2`]
[`CharT`]
[Assignment operator (must be trivial).]
]
[
[`c1 == c2`]
[`bool`]
[`true` if `c1` has the same value as `c2`.]
]
[
[`c1 != c2`]
[`bool`]
[`true` if `c1` and `c2` are not equal.]
]
[
[`c1 < c2`]
[`bool`]
[`true` if the value of `c1` is less than `c2`.]
]
[
[`c1 > c2`]
[`bool`]
[`true` if the value of `c1` is greater than `c2`.]
]
[
[`c1 <= c2`]
[`bool`]
[`true` if `c1` is less than or equal to `c2`.]
]
[
[`c1 >= c2`]
[`bool`]
[`true` if `c1` is greater than or equal to `c2`.]
]
[
[`intmax_t i = c1`]
[`int`]
[
`CharT` must be convertible to an integral type.
]
]
[
[`CharT c(i);`]
[`CharT`]
[`CharT` must be constructable from an integral type.]
]
]
[h2 Traits Requirements]
In the following table `X` denotes a traits class defining types and functions
for the character container type `CharT`; `u` is an object of type `X`; `v` is an
object of type `const X`; `p` is a value of type `const CharT*`; `I1` and `I2` are
`Input Iterators`; `c` is a value of type `const CharT`; `s` is an object of type
`X::string_type`; `cs` is an object of type `const X::string_type`; `b` is a value of
type `bool`; `i` is a value of type `int`; `F1` and `F2` are values of type `const CharT*`;
`loc` is an object of type `X::locale_type`; and `ch` is an object of `const char`.
[table Traits Requirements
[
[
[*Expression]
]
[
[*Return type]
]
[
[*Assertion / Note\n
Pre / Post condition]
]
]
[
[
`X::char_type`
]
[
`CharT`
]
[
The character container type used in the implementation of class template _basic_regex_.
]
]
[
[
`X::string_type`
]
[
`std::basic_string<CharT>` or `std::vector<CharT>`
]
[
]
]
[
[
`X::locale_type`
]
[
['Implementation defined]
]
[
A copy constructible type that represents the locale used by the traits class.
]
]
[
[
`X::char_class_type`
]
[
['Implementation defined]
]
[
A bitmask type representing a particular character classification. Multiple
values of this type can be bitwise-or'ed together to obtain a new valid value.
]
]
[
[
`X::hash(c)`
]
[
`unsigned char`
]
[
Yields a value between `0` and `UCHAR_MAX` inclusive.
]
]
[
[
`v.widen(ch)`
]
[
`CharT`
]
[
Widens the specified `char` and returns the resulting `CharT`.
]
]
[
[
`v.in_range(r1, r2, c)`
]
[
`bool`
]
[
For any characters `r1` and `r2`, returns `true` if `r1 <= c && c <= r2`.
Requires that `r1 <= r2`.
]
]
[
[
`v.in_range_nocase(r1, r2, c)`
]
[
`bool`
]
[
For characters `r1` and `r2`, returns `true` if there is some character
`d` for which `v.translate_nocase(d) == v.translate_nocase(c)` and
`r1 <= d && d <= r2`. Requires that `r1 <= r2`.
]
]
[
[
`v.translate(c)`
]
[
`X::char_type`
]
[
Returns a character such that for any character `d` that is to be considered
equivalent to `c` then `v.translate(c) == v.translate(d)`.
]
]
[
[
`v.translate_nocase(c)`
]
[
`X::char_type`
]
[
For all characters `C` that are to be considered
equivalent to `c` when comparisons are to be performed without regard to case,
then `v.translate_nocase(c) == v.translate_nocase(C)`.
]
]
[
[
`v.transform(F1, F2)`
]
[
`X::string_type`
]
[
Returns a sort key for the character sequence designated by the iterator range
`[F1, F2)` such that if the character sequence `[G1, G2)` sorts before the
character sequence `[H1, H2)` then `v.transform(G1, G2) < v.transform(H1, H2)`.
]
]
[
[
`v.transform_primary(F1, F2)`
]
[
`X::string_type`
]
[
Returns a sort key for the character sequence designated by the iterator range
`[F1, F2)` such that if the character sequence `[G1, G2)` sorts before the
character sequence `[H1, H2)` when character case is not considered then
`v.transform_primary(G1, G2) < v.transform_primary(H1, H2)`.
]
]
[
[
`v.lookup_classname(F1, F2)`
]
[
`X::char_class_type`
]
[
Converts the character sequence designated by the iterator range `[F1,F2)` into a
bitmask type that can subsequently be passed to `isctype`. Values returned from
`lookup_classname` can be safely bitwise or'ed together. Returns `0` if the
character sequence is not the name of a character class recognized by `X`. The
value returned shall be independent of the case of the characters in the
sequence.
]
]
[
[
`v.lookup_collatename(F1, F2)`
]
[
`X::string_type`
]
[
Returns a sequence of characters that represents the collating element
consisting of the character sequence designated by the iterator range `[F1, F2)`.
Returns an empty string if the character sequence is not a valid collating
element.
]
]
[
[
`v.isctype(c, v.lookup_classname(F1, F2))`
]
[
`bool`
]
[
Returns `true` if character `c` is a member of the character class designated by
the iterator range `[F1, F2)`, `false` otherwise.
]
]
[
[
`v.value(c, i)`
]
[
`int`
]
[
Returns the value represented by the digit `c` in base `i` if the character `c` is a
valid digit in base `i`; otherwise returns `-1`.\n
\[Note: the value of `i` will only be `8`, `10`, or `16`. -end note\]
]
]
[
[
`u.imbue(loc)`
]
[
`X::locale_type`
]
[
Imbues `u` with the locale `loc`, returns the previous
locale used by `u`.
]
]
[
[
`v.getloc()`
]
[
`X::locale_type`
]
[
Returns the current locale used by `v`.
]
]
]
[h2 Acknowledgements]
This section is adapted from the equivalent page in the _regexpp_ documentation and from the
_proposal_ to add regular expressions to the Standard Library.
[endsect]