• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4<html xmlns="http://www.w3.org/1999/xhtml">
5<!-- Copyright (c) Jeremy Siek and Andrew Lumsdaine 2000 -->
6<!-- Distributed under the Boost -->
7<!-- Software License, Version 1.0. (See accompanying -->
8<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
9
10<head>
11  <meta name="generator" content=
12  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
13  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
14  <link rel="stylesheet" href="../../rst.css" type="text/css" />
15
16  <title>Boost Concept Checking Reference</title>
17</head>
18
19<body bgcolor="#FFFFFF" link="#0000EE" text="#000000" vlink="#551A8B" alink=
20"#FF0000">
21  <img src="../../boost.png" alt="C++ Boost" width="277" height=
22  "86" /><br clear="none" />
23
24  <h2><a name="reference" id="reference">Reference</a></h2>
25
26  <ol>
27    <li><a href="#macros">Macros</a></li>
28
29    <li><a href="#basic-concepts">Basic Concept Checking Classes</a></li>
30
31    <li><a href="#iterator-concepts">Iterator Concept Checking
32    Classes</a></li>
33
34    <li><a href="#function-object-concepts">Function Object Concept Checking
35    Classes</a></li>
36
37    <li><a href="#container-concepts">Container Concept Checking
38    Classes</a></li>
39
40    <li><a href="#basic-archetype">Basic Archetype Classes</a></li>
41
42    <li><a href="#iterator-archetype">Iterator Archetype Classes</a></li>
43
44    <li><a href="#function-object-archetype">Function Object Archetype
45    Classes</a></li>
46
47    <li><a href="#container-archetype">Container Archetype Classes</a></li>
48
49    <li><a href="#deprecated-functions">Deprecated Functions</a></li>
50
51    <li><a href="#deprecated-macros">Deprecated Macros</a></li>
52
53    <li><a href="#deprecated-concept-checking-classes">Deprecated Concept
54    Checking Classes</a></li>
55  </ol>
56
57  <h3><a name="macros" id="macros">Macros</a></h3>
58  <pre>
59#include "boost/concept/assert.hpp"
60
61BOOST_CONCEPT_ASSERT((<em>concept checking class template specialization</em>));
62</pre>
63
64  <p><strong>Effects:</strong> causes a compilation failure if the concept is
65  not satisfied.<br />
66  <strong>Note:</strong> this macro can be used at global, class, or function
67  scope.</p>
68
69  <pre>
70#include "boost/concept/requires.hpp"
71
72<font color="gray">template &lt;…<em>template parameters</em>…&gt;</font>
73BOOST_CONCEPT_REQUIRES(
74  ((<em>concept checking class template specialization<sub>1</sub></em>))
75  ((<em>concept checking class template specialization<sub>2</sub></em>))…
76  ((<em>concept checking class template specialization<sub>n</sub></em>))<strong>,</strong>
77  (<em>function return type</em>)
78) <font color="gray"><em>function_template_name</em>(…<em>function parameters</em>…)</font>
79</pre>
80
81  <p><strong>Effects:</strong> causes a compilation failure if the
82  given concepts are not satisfied.<br />
83  <strong>Note:</strong> this macro is intended to be used in place of
84  a function template's return type.</p>
85
86  <h3><a name="basic-concepts" id="basic-concepts">Basic Concept Checking
87  Classes</a></h3>
88  <pre>
89#include "boost/concept_check.hpp"
90
91template &lt;class T&gt;
92struct Integer; // Is T a built-in integer type?
93
94template &lt;class T&gt;
95struct SignedInteger; // Is T a built-in signed integer type?
96
97template &lt;class T&gt;
98struct UnsignedInteger; // Is T a built-in unsigned integer type?
99
100template &lt;class X, class Y&gt;
101struct Convertible; // Is X convertible to Y?
102
103template &lt;class T&gt;
104struct <a href=
105"../utility/Assignable.html">Assignable</a>; // Standard ref 23.1
106
107template &lt;class T&gt;
108struct SGI<a href=
109"http://www.boost.org/sgi/stl/Assignable.html">Assignable</a>;
110
111template &lt;class T&gt;
112struct <a href=
113"http://www.boost.org/sgi/stl/DefaultConstructible.html">DefaultConstructible</a>;
114
115template &lt;class T&gt;
116struct <a href=
117"../utility/CopyConstructible.html">CopyConstructible</a>; // Standard ref 20.1.3
118
119template &lt;class T&gt;
120struct <a href=
121"http://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</a>; // Standard ref 20.1.1
122
123template &lt;class T&gt;
124struct <a href=
125"../utility/LessThanComparable.html">LessThanComparable</a>; // Standard ref 20.1.2
126
127template &lt;class T&gt;
128struct Comparable; // The SGI STL <a href=
129"http://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</a> concept
130</pre>
131
132  <h3><a name="iterator-concepts" id="iterator-concepts">Iterator Concept
133  Checking Classes</a></h3>
134  <pre>
135template &lt;class Iter&gt;
136struct <a href=
137"http://www.boost.org/sgi/stl/InputIterator.html">InputIterator</a>; // Standard ref 24.1.1 Table 72
138
139template &lt;class Iter, class T&gt;
140struct <a href=
141"http://www.boost.org/sgi/stl/OutputIterator.html">OutputIterator</a>; // Standard ref 24.1.2 Table 73
142
143template &lt;class Iter&gt;
144struct <a href=
145"http://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator</a>; // Standard ref 24.1.3 Table 74
146
147template &lt;class Iter&gt;
148struct Mutable_ForwardIterator;
149
150template &lt;class Iter&gt;
151struct <a href=
152"http://www.boost.org/sgi/stl/BidirectionalIterator.html">BidirectionalIterator</a>; // Standard ref 24.1.4 Table 75
153
154template &lt;class Iter&gt;
155struct Mutable_BidirectionalIterator;
156
157template &lt;class Iter&gt;
158struct <a href=
159"http://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator</a>; // Standard ref 24.1.5 Table 76
160
161template &lt;class Iter&gt;
162struct Mutable_RandomAccessIterator;
163</pre>
164
165  <h3><a name="function-object-concepts" id=
166  "function-object-concepts">Function Object Concept Checking
167  Classes</a></h3>
168  <pre>
169#include "boost/concept_check.hpp"
170
171template &lt;class Func, class Return&gt;
172struct <a href="http://www.boost.org/sgi/stl/Generator.html">Generator</a>;
173
174template &lt;class Func, class Return, class Arg&gt;
175struct <a href=
176"http://www.boost.org/sgi/stl/UnaryFunction.html">UnaryFunction</a>;
177
178template &lt;class Func, class Return, class First, class Second&gt;
179struct <a href=
180"http://www.boost.org/sgi/stl/BinaryFunction.html">BinaryFunction</a>;
181
182template &lt;class Func, class Arg&gt;
183struct Unary<a href=
184"http://www.boost.org/sgi/stl/Predicate.html">Predicate</a>;
185
186template &lt;class Func, class First, class Second&gt;
187struct <a href=
188"http://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate</a>;
189
190template &lt;class Func, class First, class Second&gt;
191struct Const_BinaryPredicate;
192
193template &lt;class Func, class Return&gt;
194struct <a href=
195"http://www.boost.org/sgi/stl/AdaptableGenerator.html">AdaptableGenerator</a>;
196
197template &lt;class Func, class Return, class Arg&gt;
198struct <a href=
199"http://www.boost.org/sgi/stl/AdaptableUnaryFunction.html">AdaptableUnaryFunction</a>;
200
201template &lt;class Func, class First, class Second&gt;
202struct <a href=
203"http://www.boost.org/sgi/stl/AdaptableBinaryFunction.html">AdaptableBinaryFunction</a>;
204
205template &lt;class Func, class Arg&gt;
206struct <a href=
207"http://www.boost.org/sgi/stl/AdaptablePredicate.html">AdaptablePredicate</a>;
208
209template &lt;class Func, class First, class Second&gt;
210struct <a href=
211"http://www.boost.org/sgi/stl/AdaptableBinaryPredicate.html">AdaptableBinaryPredicate</a>;
212</pre>
213
214  <h3><a name="container-concepts" id="container-concepts">Container Concept
215  Checking Classes</a></h3>
216  <pre>
217#include "boost/concept_check.hpp"
218
219template &lt;class C&gt;
220struct <a href=
221"http://www.boost.org/sgi/stl/Container.html">Container</a>; // Standard ref 23.1 Table 65
222
223template &lt;class C&gt;
224struct Mutable_Container;
225
226template &lt;class C&gt;
227struct <a href=
228"http://www.boost.org/sgi/stl/ForwardContainer.html">ForwardContainer</a>;
229
230template &lt;class C&gt;
231struct Mutable_ForwardContainer;
232
233template &lt;class C&gt;
234struct <a href=
235"http://www.boost.org/sgi/stl/ReversibleContainer.html">ReversibleContainer</a>; // Standard ref 23.1 Table 66
236
237template &lt;class C&gt;
238struct Mutable_ReversibleContainer;
239
240template &lt;class C&gt;
241struct <a href=
242"http://www.boost.org/sgi/stl/RandomAccessContainer.html">RandomAccessContainer</a>;
243
244template &lt;class C&gt;
245struct Mutable_RandomAccessContainer;
246
247template &lt;class C&gt;
248struct <a href=
249"http://www.boost.org/sgi/stl/Sequence.html">Sequence</a>; // Standard ref 23.1.1
250
251template &lt;class C&gt;
252struct <a href=
253"http://www.boost.org/sgi/stl/FrontInsertionSequence.html">FrontInsertionSequence</a>;
254
255template &lt;class C&gt;
256struct <a href=
257"http://www.boost.org/sgi/stl/BackInsertionSequence.html">BackInsertionSequence</a>;
258
259template &lt;class C&gt;
260struct <a href=
261"http://www.boost.org/sgi/stl/AssociativeContainer.html">AssociativeContainer</a>; // Standard ref 23.1.2 Table 69
262
263template &lt;class C&gt;
264struct <a href=
265"http://www.boost.org/sgi/stl/UniqueAssociativeContainer.html">UniqueAssociativeContainer</a>;
266
267template &lt;class C&gt;
268struct <a href=
269"http://www.boost.org/sgi/stl/MultipleAssociativeContainer.html">MultipleAssociativeContainer</a>;
270
271template &lt;class C&gt;
272struct <a href=
273"http://www.boost.org/sgi/stl/SimpleAssociativeContainer.html">SimpleAssociativeContainer</a>;
274
275template &lt;class C&gt;
276struct <a href=
277"http://www.boost.org/sgi/stl/PairAssociativeContainer.html">PairAssociativeContainer</a>;
278
279template &lt;class C&gt;
280struct <a href=
281"http://www.boost.org/sgi/stl/SortedAssociativeContainer.html">SortedAssociativeContainer</a>;
282
283template &lt;class C&gt;
284struct <a href=
285"../utility/Collection.html">Collection</a>;
286</pre>
287
288  <h3><a name="basic-archetype" id="basic-archetype">Basic Archetype
289  Classes</a></h3>
290  <pre>
291#include "boost/concept_archetype.hpp"
292
293template &lt;class T = int&gt;
294class null_archetype; // A type that models no concepts.
295
296template &lt;class Base = null_archetype&gt;
297class default_constructible_archetype;
298
299template &lt;class Base = null_archetype&gt;
300class assignable_archetype;
301
302template &lt;class Base = null_archetype&gt;
303class copy_constructible_archetype;
304
305template &lt;class Base = null_archetype&gt;
306class equality_comparable_archetype;
307
308template &lt;class T, class Base = null_archetype&gt;
309class convertible_to_archetype;
310</pre>
311
312  <h3><a name="iterator-archetype" id="iterator-archetype">Iterator Archetype
313  Classes</a></h3>
314  <pre>
315#include "boost/concept_archetype.hpp"
316
317template &lt;class ValueType&gt;
318class trivial_iterator_archetype;
319
320template &lt;class ValueType&gt;
321class mutable_trivial_iterator_archetype;
322
323template &lt;class ValueType&gt;
324class input_iterator_archetype;
325
326template &lt;class ValueType&gt;
327class forward_iterator_archetype;
328
329template &lt;class ValueType&gt;
330class bidirectional_iterator_archetype;
331
332template &lt;class ValueType&gt;
333class random_access_iterator_archetype;
334</pre>
335
336  <h3><a name="function-object-archetype" id=
337  "function-object-archetype">Function Object Archetype Classes</a></h3>
338  <pre>
339#include "boost/concept_archetype.hpp"
340
341template &lt;class Arg, class Return&gt;
342class unary_function_archetype;
343
344template &lt;class Arg1, class Arg2, class Return&gt;
345class binary_function_archetype;
346
347template &lt;class Arg&gt;
348class predicate_archetype;
349
350template &lt;class Arg1, class Arg2&gt;
351class binary_predicate_archetype;
352</pre>
353
354  <h3><a name="container-archetype" id="container-archetype">Container
355  Archetype Classes</a></h3>
356  <pre>
357UNDER CONSTRUCTION
358</pre>
359
360  <h3><a name="deprecated-functions" id="deprecated-functions">Deprecated
361  Functions</a></h3>
362  <pre>
363#include "boost/concept_check.hpp"
364
365template &lt;class Concept&gt;
366void function_requires();
367</pre>
368
369  <p><code>function_requires()</code> has been deprecated in favor of <code>BOOST_CONCEPT_ASSERT</code>.
370   This means that <del><code>function_requires< Concept<Type> >();</code></del>
371   becomes <code>BOOST_CONCEPT_ASSERT((Concept<Type>));</code>
372   (don't forget to <code>#include &quot;boost/concept/assert.hpp&quot;</code>).
373
374
375  <h3><a name="deprecated-macros" id="deprecated-macros">Deprecated
376  Macros</a></h3>
377  <pre>
378#include "boost/concept_check.hpp"
379
380// Apply concept checks in class definitions.
381BOOST_CLASS_REQUIRE(<i>type</i>, <i>namespace-of-concept</i>, <i>concept</i>);
382BOOST_CLASS_REQUIRE2(<i>type1</i>, <i>type2</i>, <i>namespace-of-concept</i>, <i>concept</i>);
383BOOST_CLASS_REQUIRE3(<i>type1</i>, <i>type2</i>, <i>type3</i>, <i>namespace-of-concept</i>, <i>concept</i>);
384BOOST_CLASS_REQUIRE4(<i>type1</i>, <i>type2</i>, <i>type3</i>, <i>type4</i>, <i>namespace-of-concept</i>, <i>concept</i>);
385
386// Apply concept checks in class definitions.
387BOOST_CLASS_REQUIRES(<i>type</i>, <i>concept</i>);
388BOOST_CLASS_REQUIRES2(<i>type1</i>, <i>type2</i>, <i>concept</i>);
389BOOST_CLASS_REQUIRES3(<i>type1</i>, <i>type2</i>, <i>type3</i>, <i>concept</i>);
390BOOST_CLASS_REQUIRES4(<i>type1</i>, <i>type2</i>, <i>type3</i>, <i>type4</i>, <i>concept</i>);
391</pre>
392
393  <h3><a name="deprecated-concept-checking-classes" id=
394  "deprecated-concept-checking-classes">Deprecated Concept Checking
395  Classes</a></h3>
396
397  <p>For each of the concepts documented here, the library includes an
398  identical concept checking class whose name ends in
399  “<code>Concept</code>” For example, in
400  addition to <code>RandomAccessIterator</code>, the library defines a
401  <code>RandomAccessIteratorConcept</code> class template.</p>
402
403  <p><a href="./concept_check.htm">Back to Introduction</a><br />
404  <a href="./implementation.htm">Prev: Implementation</a><br /></p>
405  <hr />
406
407  <table>
408    <tr valign="top">
409      <td nowrap="nowrap">Copyright &copy; 2000</td>
410
411      <td><a href="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</a>(<a href=
412      "mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</a>) Andrew
413      Lumsdaine(<a href="mailto:lums@osl.iu.edu">lums@osl.iu.edu</a>), 2007
414      <a href="mailto:dave@boost-consulting.com">David Abrahams</a>.</td>
415    </tr>
416  </table>
417</body>
418</html>
419