summaryrefslogtreecommitdiff
path: root/libs/concept_check/reference.htm
blob: ae8d50215ab782d3c081508ef17b96e1d5332053 (plain)
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Copyright (c) Jeremy Siek and Andrew Lumsdaine 2000 -->
<!-- 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) -->

<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="../../rst.css" type="text/css" />

  <title>Boost Concept Checking Reference</title>
</head>

<body bgcolor="#FFFFFF" link="#0000EE" text="#000000" vlink="#551A8B" alink=
"#FF0000">
  <img src="../../boost.png" alt="C++ Boost" width="277" height=
  "86" /><br clear="none" />

  <h2><a name="reference" id="reference">Reference</a></h2>

  <ol>
    <li><a href="#macros">Macros</a></li>

    <li><a href="#basic-concepts">Basic Concept Checking Classes</a></li>

    <li><a href="#iterator-concepts">Iterator Concept Checking
    Classes</a></li>

    <li><a href="#function-object-concepts">Function Object Concept Checking
    Classes</a></li>

    <li><a href="#container-concepts">Container Concept Checking
    Classes</a></li>

    <li><a href="#basic-archetype">Basic Archetype Classes</a></li>

    <li><a href="#iterator-archetype">Iterator Archetype Classes</a></li>

    <li><a href="#function-object-archetype">Function Object Archetype
    Classes</a></li>

    <li><a href="#container-archetype">Container Archetype Classes</a></li>

    <li><a href="#deprecated-functions">Deprecated Functions</a></li>

    <li><a href="#deprecated-macros">Deprecated Macros</a></li>

    <li><a href="#deprecated-concept-checking-classes">Deprecated Concept
    Checking Classes</a></li>
  </ol>

  <h3><a name="macros" id="macros">Macros</a></h3>
  <pre>
#include "boost/concept/assert.hpp"

BOOST_CONCEPT_ASSERT((<em>concept checking class template specialization</em>));
</pre>

  <p><strong>Effects:</strong> causes a compilation failure if the concept is
  not satisfied.<br />
  <strong>Note:</strong> this macro can be used at global, class, or function
  scope.</p>

  <pre>
#include "boost/concept/requires.hpp"

<font color="gray">template &lt;…<em>template parameters</em>…&gt;</font>
BOOST_CONCEPT_REQUIRES(
  ((<em>concept checking class template specialization<sub>1</sub></em>)) 
  ((<em>concept checking class template specialization<sub>2</sub></em>))… 
  ((<em>concept checking class template specialization<sub>n</sub></em>))<strong>,</strong>
  (<em>function return type</em>)
) <font color="gray"><em>function_template_name</em>(…<em>function parameters</em>…)</font>
</pre>

  <p><strong>Effects:</strong> causes a compilation failure if the
  given concepts are not satisfied.<br />
  <strong>Note:</strong> this macro is intended to be used in place of
  a function template's return type.</p>

  <h3><a name="basic-concepts" id="basic-concepts">Basic Concept Checking
  Classes</a></h3>
  <pre>
#include "boost/concept_check.hpp"

template &lt;class T&gt;
struct Integer; // Is T a built-in integer type?

template &lt;class T&gt;
struct SignedInteger; // Is T a built-in signed integer type?

template &lt;class T&gt;
struct UnsignedInteger; // Is T a built-in unsigned integer type?

template &lt;class X, class Y&gt;
struct Convertible; // Is X convertible to Y?

template &lt;class T&gt;
struct <a href=
"../utility/Assignable.html">Assignable</a>; // Standard ref 23.1

template &lt;class T&gt;
struct SGI<a href=
"http://www.sgi.com/tech/stl/Assignable.html">Assignable</a>;

template &lt;class T&gt;
struct <a href=
"http://www.sgi.com/tech/stl/DefaultConstructible.html">DefaultConstructible</a>;

template &lt;class T&gt; 
struct <a href=
"../utility/CopyConstructible.html">CopyConstructible</a>; // Standard ref 20.1.3

template &lt;class T&gt; 
struct <a href=
"http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</a>; // Standard ref 20.1.1

template &lt;class T&gt;
struct <a href=
"../utility/LessThanComparable.html">LessThanComparable</a>; // Standard ref 20.1.2

template &lt;class T&gt;
struct Comparable; // The SGI STL <a href=
"http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</a> concept
</pre>

  <h3><a name="iterator-concepts" id="iterator-concepts">Iterator Concept
  Checking Classes</a></h3>
  <pre>
template &lt;class Iter&gt;
struct <a href=
"http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</a>; // Standard ref 24.1.1 Table 72

template &lt;class Iter, class T&gt; 
struct <a href=
"http://www.sgi.com/tech/stl/OutputIterator.html">OutputIterator</a>; // Standard ref 24.1.2 Table 73

template &lt;class Iter&gt; 
struct <a href=
"http://www.sgi.com/tech/stl/ForwardIterator.html">ForwardIterator</a>; // Standard ref 24.1.3 Table 74

template &lt;class Iter&gt; 
struct Mutable_ForwardIterator;

template &lt;class Iter&gt; 
struct <a href=
"http://www.sgi.com/tech/stl/BidirectionalIterator.html">BidirectionalIterator</a>; // Standard ref 24.1.4 Table 75

template &lt;class Iter&gt; 
struct Mutable_BidirectionalIterator;

template &lt;class Iter&gt; 
struct <a href=
"http://www.sgi.com/tech/stl/RandomAccessIterator.html">RandomAccessIterator</a>; // Standard ref 24.1.5 Table 76

template &lt;class Iter&gt; 
struct Mutable_RandomAccessIterator;
</pre>

  <h3><a name="function-object-concepts" id=
  "function-object-concepts">Function Object Concept Checking
  Classes</a></h3>
  <pre>
#include "boost/concept_check.hpp"

template &lt;class Func, class Return&gt;
struct <a href="http://www.sgi.com/tech/stl/Generator.html">Generator</a>;

template &lt;class Func, class Return, class Arg&gt;
struct <a href=
"http://www.sgi.com/tech/stl/UnaryFunction.html">UnaryFunction</a>;

template &lt;class Func, class Return, class First, class Second&gt;
struct <a href=
"http://www.sgi.com/tech/stl/BinaryFunction.html">BinaryFunction</a>;

template &lt;class Func, class Arg&gt;
struct Unary<a href=
"http://www.sgi.com/tech/stl/Predicate.html">Predicate</a>;

template &lt;class Func, class First, class Second&gt;
struct <a href=
"http://www.sgi.com/tech/stl/BinaryPredicate.html">BinaryPredicate</a>;

template &lt;class Func, class First, class Second&gt;
struct Const_BinaryPredicate;

template &lt;class Func, class Return&gt;
struct <a href=
"http://www.sgi.com/tech/stl/AdaptableGenerator.html">AdaptableGenerator</a>;

template &lt;class Func, class Return, class Arg&gt;
struct <a href=
"http://www.sgi.com/tech/stl/AdaptableUnaryFunction.html">AdaptableUnaryFunction</a>;

template &lt;class Func, class First, class Second&gt;
struct <a href=
"http://www.sgi.com/tech/stl/AdaptableBinaryFunction.html">AdaptableBinaryFunction</a>;

template &lt;class Func, class Arg&gt;
struct <a href=
"http://www.sgi.com/tech/stl/AdaptablePredicate.html">AdaptablePredicate</a>;

template &lt;class Func, class First, class Second&gt;
struct <a href=
"http://www.sgi.com/tech/stl/AdaptableBinaryPredicate.html">AdaptableBinaryPredicate</a>;
</pre>

  <h3><a name="container-concepts" id="container-concepts">Container Concept
  Checking Classes</a></h3>
  <pre>
#include "boost/concept_check.hpp"

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/Container.html">Container</a>; // Standard ref 23.1 Table 65

template &lt;class C&gt;
struct Mutable_Container;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/ForwardContainer.html">ForwardContainer</a>;

template &lt;class C&gt;
struct Mutable_ForwardContainer;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/ReversibleContainer.html">ReversibleContainer</a>; // Standard ref 23.1 Table 66

template &lt;class C&gt;
struct Mutable_ReversibleContainer;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/RandomAccessContainer.html">RandomAccessContainer</a>;

template &lt;class C&gt;
struct Mutable_RandomAccessContainer;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/Sequence.html">Sequence</a>; // Standard ref 23.1.1

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/FrontInsertionSequence.html">FrontInsertionSequence</a>;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/BackInsertionSequence.html">BackInsertionSequence</a>;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/AssociativeContainer.html">AssociativeContainer</a>; // Standard ref 23.1.2 Table 69

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html">UniqueAssociativeContainer</a>;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/MultipleAssociativeContainer.html">MultipleAssociativeContainer</a>;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/SimpleAssociativeContainer.html">SimpleAssociativeContainer</a>;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/PairAssociativeContainer.html">PairAssociativeContainer</a>;

template &lt;class C&gt;
struct <a href=
"http://www.sgi.com/tech/stl/SortedAssociativeContainer.html">SortedAssociativeContainer</a>;

template &lt;class C&gt;
struct <a href=
"../utility/Collection.html">Collection</a>;
</pre>

  <h3><a name="basic-archetype" id="basic-archetype">Basic Archetype
  Classes</a></h3>
  <pre>
#include "boost/concept_archetype.hpp"

template &lt;class T = int&gt;
class null_archetype; // A type that models no concepts.

template &lt;class Base = null_archetype&gt;
class default_constructible_archetype;

template &lt;class Base = null_archetype&gt;
class assignable_archetype;

template &lt;class Base = null_archetype&gt;
class copy_constructible_archetype;

template &lt;class Base = null_archetype&gt;
class equality_comparable_archetype;

template &lt;class T, class Base = null_archetype&gt;
class convertible_to_archetype;
</pre>

  <h3><a name="iterator-archetype" id="iterator-archetype">Iterator Archetype
  Classes</a></h3>
  <pre>
#include "boost/concept_archetype.hpp"

template &lt;class ValueType&gt;
class trivial_iterator_archetype;

template &lt;class ValueType&gt;
class mutable_trivial_iterator_archetype;

template &lt;class ValueType&gt;
class input_iterator_archetype;

template &lt;class ValueType&gt;
class forward_iterator_archetype;

template &lt;class ValueType&gt;
class bidirectional_iterator_archetype;

template &lt;class ValueType&gt;
class random_access_iterator_archetype;
</pre>

  <h3><a name="function-object-archetype" id=
  "function-object-archetype">Function Object Archetype Classes</a></h3>
  <pre>
#include "boost/concept_archetype.hpp"

template &lt;class Arg, class Return&gt;
class unary_function_archetype;

template &lt;class Arg1, class Arg2, class Return&gt;
class binary_function_archetype;

template &lt;class Arg&gt;
class predicate_archetype;

template &lt;class Arg1, class Arg2&gt;
class binary_predicate_archetype;
</pre>

  <h3><a name="container-archetype" id="container-archetype">Container
  Archetype Classes</a></h3>
  <pre>
UNDER CONSTRUCTION
</pre>

  <h3><a name="deprecated-functions" id="deprecated-functions">Deprecated
  Functions</a></h3>
  <pre>
#include "boost/concept_check.hpp"

template &lt;class Concept&gt;
void function_requires();
</pre>

  <p><code>function_requires()</code> has been deprecated in favor of <code>BOOST_CONCEPT_ASSERT</code>.
   This means that <del><code>function_requires< Concept<Type> >();</code></del>
   becomes <code>BOOST_CONCEPT_ASSERT((Concept<Type>));</code>
   (don't forget to <code>#include &quot;boost/concept/assert.hpp&quot;</code>).


  <h3><a name="deprecated-macros" id="deprecated-macros">Deprecated
  Macros</a></h3>
  <pre>
#include "boost/concept_check.hpp"

// Apply concept checks in class definitions.
BOOST_CLASS_REQUIRE(<i>type</i>, <i>namespace-of-concept</i>, <i>concept</i>);
BOOST_CLASS_REQUIRE2(<i>type1</i>, <i>type2</i>, <i>namespace-of-concept</i>, <i>concept</i>);
BOOST_CLASS_REQUIRE3(<i>type1</i>, <i>type2</i>, <i>type3</i>, <i>namespace-of-concept</i>, <i>concept</i>);
BOOST_CLASS_REQUIRE4(<i>type1</i>, <i>type2</i>, <i>type3</i>, <i>type4</i>, <i>namespace-of-concept</i>, <i>concept</i>);

// Apply concept checks in class definitions.
BOOST_CLASS_REQUIRES(<i>type</i>, <i>concept</i>);
BOOST_CLASS_REQUIRES2(<i>type1</i>, <i>type2</i>, <i>concept</i>);
BOOST_CLASS_REQUIRES3(<i>type1</i>, <i>type2</i>, <i>type3</i>, <i>concept</i>);
BOOST_CLASS_REQUIRES4(<i>type1</i>, <i>type2</i>, <i>type3</i>, <i>type4</i>, <i>concept</i>);
</pre>

  <h3><a name="deprecated-concept-checking-classes" id=
  "deprecated-concept-checking-classes">Deprecated Concept Checking
  Classes</a></h3>

  <p>For each of the concepts documented here, the library includes an
  identical concept checking class whose name ends in
  “<code>Concept</code>” For example, in
  addition to <code>RandomAccessIterator</code>, the library defines a
  <code>RandomAccessIteratorConcept</code> class template.</p>

  <p><a href="./concept_check.htm">Back to Introduction</a><br />
  <a href="./implementation.htm">Prev: Implementation</a><br /></p>
  <hr />

  <table>
    <tr valign="top">
      <td nowrap="nowrap">Copyright &copy; 2000</td>

      <td><a href="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</a>(<a href=
      "mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</a>) Andrew
      Lumsdaine(<a href="mailto:lums@osl.iu.edu">lums@osl.iu.edu</a>), 2007
      <a href="mailto:dave@boost-consulting.com">David Abrahams</a>.</td>
    </tr>
  </table>
</body>
</html>