...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
#include "boost/concept/assert.hpp" BOOST_CONCEPT_ASSERT((concept checking class template specialization));
Effects: causes a compilation failure if the concept is
not satisfied.
Note: this macro can be used at global, class, or function
scope.
#include "boost/concept/requires.hpp" template <…template parameters…> BOOST_CONCEPT_REQUIRES( ((concept checking class template specialization1)) ((concept checking class template specialization2))… ((concept checking class template specializationn)), (function return type) ) function_template_name(…function parameters…)
Effects: causes a compilation failure if the
given concepts are not satisfied.
Note: this macro is intended to be used in place of
a function template's return type.
#include "boost/concept_check.hpp" templatestruct Integer; // Is T a built-in integer type? template struct SignedInteger; // Is T a built-in signed integer type? template struct UnsignedInteger; // Is T a built-in unsigned integer type? template struct Convertible; // Is X convertible to Y? template struct Assignable; // Standard ref 23.1 template struct SGIAssignable; template struct DefaultConstructible; template struct CopyConstructible; // Standard ref 20.1.3 template struct EqualityComparable; // Standard ref 20.1.1 template struct LessThanComparable; // Standard ref 20.1.2 template struct Comparable; // The SGI STL LessThanComparable concept
templatestruct InputIterator; // Standard ref 24.1.1 Table 72 template struct OutputIterator; // Standard ref 24.1.2 Table 73 template struct ForwardIterator; // Standard ref 24.1.3 Table 74 template struct Mutable_ForwardIterator; template struct BidirectionalIterator; // Standard ref 24.1.4 Table 75 template struct Mutable_BidirectionalIterator; template struct RandomAccessIterator; // Standard ref 24.1.5 Table 76 template struct Mutable_RandomAccessIterator;
#include "boost/concept_check.hpp" templatestruct Generator; template struct UnaryFunction; template struct BinaryFunction; template struct UnaryPredicate; template struct BinaryPredicate; template struct Const_BinaryPredicate; template struct AdaptableGenerator; template struct AdaptableUnaryFunction; template struct AdaptableBinaryFunction; template struct AdaptablePredicate; template struct AdaptableBinaryPredicate;
#include "boost/concept_check.hpp" templatestruct Container; // Standard ref 23.1 Table 65 template struct Mutable_Container; template struct ForwardContainer; template struct Mutable_ForwardContainer; template struct ReversibleContainer; // Standard ref 23.1 Table 66 template struct Mutable_ReversibleContainer; template struct RandomAccessContainer; template struct Mutable_RandomAccessContainer; template struct Sequence; // Standard ref 23.1.1 template struct FrontInsertionSequence; template struct BackInsertionSequence; template struct AssociativeContainer; // Standard ref 23.1.2 Table 69 template struct UniqueAssociativeContainer; template struct MultipleAssociativeContainer; template struct SimpleAssociativeContainer; template struct PairAssociativeContainer; template struct SortedAssociativeContainer; template struct Collection;
#include "boost/concept_archetype.hpp" templateclass null_archetype; // A type that models no concepts. template class default_constructible_archetype; template class assignable_archetype; template class copy_constructible_archetype; template class equality_comparable_archetype; template class convertible_to_archetype;
#include "boost/concept_archetype.hpp" templateclass trivial_iterator_archetype; template class mutable_trivial_iterator_archetype; template class input_iterator_archetype; template class forward_iterator_archetype; template class bidirectional_iterator_archetype; template class random_access_iterator_archetype;
#include "boost/concept_archetype.hpp" templateclass unary_function_archetype; template class binary_function_archetype; template class predicate_archetype; template class binary_predicate_archetype;
UNDER CONSTRUCTION
#include "boost/concept_check.hpp" templatevoid function_requires();
function_requires()
has been deprecated in favor of BOOST_CONCEPT_ASSERT
.
This means that
becomes function_requires< Concept
BOOST_CONCEPT_ASSERT((Concept
(don't forget to #include "boost/concept/assert.hpp"
).
#include "boost/concept_check.hpp" // Apply concept checks in class definitions. BOOST_CLASS_REQUIRE(type, namespace-of-concept, concept); BOOST_CLASS_REQUIRE2(type1, type2, namespace-of-concept, concept); BOOST_CLASS_REQUIRE3(type1, type2, type3, namespace-of-concept, concept); BOOST_CLASS_REQUIRE4(type1, type2, type3, type4, namespace-of-concept, concept); // Apply concept checks in class definitions. BOOST_CLASS_REQUIRES(type, concept); BOOST_CLASS_REQUIRES2(type1, type2, concept); BOOST_CLASS_REQUIRES3(type1, type2, type3, concept); BOOST_CLASS_REQUIRES4(type1, type2, type3, type4, concept);
For each of the concepts documented here, the library includes an
identical concept checking class whose name ends in
“Concept
” For example, in
addition to RandomAccessIterator
, the library defines a
RandomAccessIteratorConcept
class template.
Back to Introduction
Prev: Implementation
Copyright © 2000 | Jeremy Siek(jsiek@osl.iu.edu) Andrew Lumsdaine(lums@osl.iu.edu), 2007 David Abrahams. |