1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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) -->
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" />
16 <title>Boost Concept Checking Reference
</title>
19 <body bgcolor=
"#FFFFFF" link=
"#0000EE" text=
"#000000" vlink=
"#551A8B" alink=
21 <img src=
"../../boost.png" alt=
"C++ Boost" width=
"277" height=
22 "86" /><br clear=
"none" />
24 <h2><a name=
"reference" id=
"reference">Reference
</a></h2>
27 <li><a href=
"#macros">Macros
</a></li>
29 <li><a href=
"#basic-concepts">Basic Concept Checking Classes
</a></li>
31 <li><a href=
"#iterator-concepts">Iterator Concept Checking
34 <li><a href=
"#function-object-concepts">Function Object Concept Checking
37 <li><a href=
"#container-concepts">Container Concept Checking
40 <li><a href=
"#basic-archetype">Basic Archetype Classes
</a></li>
42 <li><a href=
"#iterator-archetype">Iterator Archetype Classes
</a></li>
44 <li><a href=
"#function-object-archetype">Function Object Archetype
47 <li><a href=
"#container-archetype">Container Archetype Classes
</a></li>
49 <li><a href=
"#deprecated-functions">Deprecated Functions
</a></li>
51 <li><a href=
"#deprecated-macros">Deprecated Macros
</a></li>
53 <li><a href=
"#deprecated-concept-checking-classes">Deprecated Concept
54 Checking Classes
</a></li>
57 <h3><a name=
"macros" id=
"macros">Macros
</a></h3>
59 #include
"boost/concept/assert.hpp"
61 BOOST_CONCEPT_ASSERT((
<em>concept checking class template specialization
</em>));
64 <p><strong>Effects:
</strong> causes a compilation failure if the concept is
66 <strong>Note:
</strong> this macro can be used at global, class, or function
70 #include
"boost/concept/requires.hpp"
72 <font color=
"gray">template
<…
<em>template parameters
</em>…
></font>
73 BOOST_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>
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>
86 <h3><a name=
"basic-concepts" id=
"basic-concepts">Basic Concept Checking
89 #include
"boost/concept_check.hpp"
91 template
<class T
>
92 struct Integer; // Is T a built-in integer type?
94 template
<class T
>
95 struct SignedInteger; // Is T a built-in signed integer type?
97 template
<class T
>
98 struct UnsignedInteger; // Is T a built-in unsigned integer type?
100 template
<class X, class Y
>
101 struct Convertible; // Is X convertible to Y?
103 template
<class T
>
105 "../utility/Assignable.html">Assignable
</a>; // Standard ref
23.1
107 template
<class T
>
109 "http://www.boost.org/sgi/stl/Assignable.html">Assignable
</a>;
111 template
<class T
>
113 "http://www.boost.org/sgi/stl/DefaultConstructible.html">DefaultConstructible
</a>;
115 template
<class T
>
117 "../utility/CopyConstructible.html">CopyConstructible
</a>; // Standard ref
20.1.3
119 template
<class T
>
121 "http://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable
</a>; // Standard ref
20.1.1
123 template
<class T
>
125 "../utility/LessThanComparable.html">LessThanComparable
</a>; // Standard ref
20.1.2
127 template
<class T
>
128 struct Comparable; // The SGI STL
<a href=
129 "http://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable
</a> concept
132 <h3><a name=
"iterator-concepts" id=
"iterator-concepts">Iterator Concept
133 Checking Classes
</a></h3>
135 template
<class Iter
>
137 "http://www.boost.org/sgi/stl/InputIterator.html">InputIterator
</a>; // Standard ref
24.1.1 Table
72
139 template
<class Iter, class T
>
141 "http://www.boost.org/sgi/stl/OutputIterator.html">OutputIterator
</a>; // Standard ref
24.1.2 Table
73
143 template
<class Iter
>
145 "http://www.boost.org/sgi/stl/ForwardIterator.html">ForwardIterator
</a>; // Standard ref
24.1.3 Table
74
147 template
<class Iter
>
148 struct Mutable_ForwardIterator;
150 template
<class Iter
>
152 "http://www.boost.org/sgi/stl/BidirectionalIterator.html">BidirectionalIterator
</a>; // Standard ref
24.1.4 Table
75
154 template
<class Iter
>
155 struct Mutable_BidirectionalIterator;
157 template
<class Iter
>
159 "http://www.boost.org/sgi/stl/RandomAccessIterator.html">RandomAccessIterator
</a>; // Standard ref
24.1.5 Table
76
161 template
<class Iter
>
162 struct Mutable_RandomAccessIterator;
165 <h3><a name=
"function-object-concepts" id=
166 "function-object-concepts">Function Object Concept Checking
169 #include
"boost/concept_check.hpp"
171 template
<class Func, class Return
>
172 struct
<a href=
"http://www.boost.org/sgi/stl/Generator.html">Generator
</a>;
174 template
<class Func, class Return, class Arg
>
176 "http://www.boost.org/sgi/stl/UnaryFunction.html">UnaryFunction
</a>;
178 template
<class Func, class Return, class First, class Second
>
180 "http://www.boost.org/sgi/stl/BinaryFunction.html">BinaryFunction
</a>;
182 template
<class Func, class Arg
>
184 "http://www.boost.org/sgi/stl/Predicate.html">Predicate
</a>;
186 template
<class Func, class First, class Second
>
188 "http://www.boost.org/sgi/stl/BinaryPredicate.html">BinaryPredicate
</a>;
190 template
<class Func, class First, class Second
>
191 struct Const_BinaryPredicate;
193 template
<class Func, class Return
>
195 "http://www.boost.org/sgi/stl/AdaptableGenerator.html">AdaptableGenerator
</a>;
197 template
<class Func, class Return, class Arg
>
199 "http://www.boost.org/sgi/stl/AdaptableUnaryFunction.html">AdaptableUnaryFunction
</a>;
201 template
<class Func, class First, class Second
>
203 "http://www.boost.org/sgi/stl/AdaptableBinaryFunction.html">AdaptableBinaryFunction
</a>;
205 template
<class Func, class Arg
>
207 "http://www.boost.org/sgi/stl/AdaptablePredicate.html">AdaptablePredicate
</a>;
209 template
<class Func, class First, class Second
>
211 "http://www.boost.org/sgi/stl/AdaptableBinaryPredicate.html">AdaptableBinaryPredicate
</a>;
214 <h3><a name=
"container-concepts" id=
"container-concepts">Container Concept
215 Checking Classes
</a></h3>
217 #include
"boost/concept_check.hpp"
219 template
<class C
>
221 "http://www.boost.org/sgi/stl/Container.html">Container
</a>; // Standard ref
23.1 Table
65
223 template
<class C
>
224 struct Mutable_Container;
226 template
<class C
>
228 "http://www.boost.org/sgi/stl/ForwardContainer.html">ForwardContainer
</a>;
230 template
<class C
>
231 struct Mutable_ForwardContainer;
233 template
<class C
>
235 "http://www.boost.org/sgi/stl/ReversibleContainer.html">ReversibleContainer
</a>; // Standard ref
23.1 Table
66
237 template
<class C
>
238 struct Mutable_ReversibleContainer;
240 template
<class C
>
242 "http://www.boost.org/sgi/stl/RandomAccessContainer.html">RandomAccessContainer
</a>;
244 template
<class C
>
245 struct Mutable_RandomAccessContainer;
247 template
<class C
>
249 "http://www.boost.org/sgi/stl/Sequence.html">Sequence
</a>; // Standard ref
23.1.1
251 template
<class C
>
253 "http://www.boost.org/sgi/stl/FrontInsertionSequence.html">FrontInsertionSequence
</a>;
255 template
<class C
>
257 "http://www.boost.org/sgi/stl/BackInsertionSequence.html">BackInsertionSequence
</a>;
259 template
<class C
>
261 "http://www.boost.org/sgi/stl/AssociativeContainer.html">AssociativeContainer
</a>; // Standard ref
23.1.2 Table
69
263 template
<class C
>
265 "http://www.boost.org/sgi/stl/UniqueAssociativeContainer.html">UniqueAssociativeContainer
</a>;
267 template
<class C
>
269 "http://www.boost.org/sgi/stl/MultipleAssociativeContainer.html">MultipleAssociativeContainer
</a>;
271 template
<class C
>
273 "http://www.boost.org/sgi/stl/SimpleAssociativeContainer.html">SimpleAssociativeContainer
</a>;
275 template
<class C
>
277 "http://www.boost.org/sgi/stl/PairAssociativeContainer.html">PairAssociativeContainer
</a>;
279 template
<class C
>
281 "http://www.boost.org/sgi/stl/SortedAssociativeContainer.html">SortedAssociativeContainer
</a>;
283 template
<class C
>
285 "../utility/Collection.html">Collection
</a>;
288 <h3><a name=
"basic-archetype" id=
"basic-archetype">Basic Archetype
291 #include
"boost/concept_archetype.hpp"
293 template
<class T = int
>
294 class null_archetype; // A type that models no concepts.
296 template
<class Base = null_archetype
>
297 class default_constructible_archetype;
299 template
<class Base = null_archetype
>
300 class assignable_archetype;
302 template
<class Base = null_archetype
>
303 class copy_constructible_archetype;
305 template
<class Base = null_archetype
>
306 class equality_comparable_archetype;
308 template
<class T, class Base = null_archetype
>
309 class convertible_to_archetype;
312 <h3><a name=
"iterator-archetype" id=
"iterator-archetype">Iterator Archetype
315 #include
"boost/concept_archetype.hpp"
317 template
<class ValueType
>
318 class trivial_iterator_archetype;
320 template
<class ValueType
>
321 class mutable_trivial_iterator_archetype;
323 template
<class ValueType
>
324 class input_iterator_archetype;
326 template
<class ValueType
>
327 class forward_iterator_archetype;
329 template
<class ValueType
>
330 class bidirectional_iterator_archetype;
332 template
<class ValueType
>
333 class random_access_iterator_archetype;
336 <h3><a name=
"function-object-archetype" id=
337 "function-object-archetype">Function Object Archetype Classes
</a></h3>
339 #include
"boost/concept_archetype.hpp"
341 template
<class Arg, class Return
>
342 class unary_function_archetype;
344 template
<class Arg1, class Arg2, class Return
>
345 class binary_function_archetype;
347 template
<class Arg
>
348 class predicate_archetype;
350 template
<class Arg1, class Arg2
>
351 class binary_predicate_archetype;
354 <h3><a name=
"container-archetype" id=
"container-archetype">Container
355 Archetype Classes
</a></h3>
360 <h3><a name=
"deprecated-functions" id=
"deprecated-functions">Deprecated
363 #include
"boost/concept_check.hpp"
365 template
<class Concept
>
366 void function_requires();
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
"boost/concept/assert.hpp
"</code>).
375 <h3><a name=
"deprecated-macros" id=
"deprecated-macros">Deprecated
378 #include
"boost/concept_check.hpp"
380 // Apply concept checks in class definitions.
381 BOOST_CLASS_REQUIRE(
<i>type
</i>,
<i>namespace-of-concept
</i>,
<i>concept
</i>);
382 BOOST_CLASS_REQUIRE2(
<i>type1
</i>,
<i>type2
</i>,
<i>namespace-of-concept
</i>,
<i>concept
</i>);
383 BOOST_CLASS_REQUIRE3(
<i>type1
</i>,
<i>type2
</i>,
<i>type3
</i>,
<i>namespace-of-concept
</i>,
<i>concept
</i>);
384 BOOST_CLASS_REQUIRE4(
<i>type1
</i>,
<i>type2
</i>,
<i>type3
</i>,
<i>type4
</i>,
<i>namespace-of-concept
</i>,
<i>concept
</i>);
386 // Apply concept checks in class definitions.
387 BOOST_CLASS_REQUIRES(
<i>type
</i>,
<i>concept
</i>);
388 BOOST_CLASS_REQUIRES2(
<i>type1
</i>,
<i>type2
</i>,
<i>concept
</i>);
389 BOOST_CLASS_REQUIRES3(
<i>type1
</i>,
<i>type2
</i>,
<i>type3
</i>,
<i>concept
</i>);
390 BOOST_CLASS_REQUIRES4(
<i>type1
</i>,
<i>type2
</i>,
<i>type3
</i>,
<i>type4
</i>,
<i>concept
</i>);
393 <h3><a name=
"deprecated-concept-checking-classes" id=
394 "deprecated-concept-checking-classes">Deprecated Concept Checking
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>
403 <p><a href=
"./concept_check.htm">Back to Introduction
</a><br />
404 <a href=
"./implementation.htm">Prev: Implementation
</a><br /></p>
409 <td nowrap=
"nowrap">Copyright
© 2000</td>
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>