Boost Concept Checking Reference

## Reference

1. Macros
2. Basic Concept Checking Classes
3. Iterator Concept Checking Classes
4. Function Object Concept Checking Classes
5. Container Concept Checking Classes
6. Basic Archetype Classes
7. Iterator Archetype Classes
8. Function Object Archetype Classes
9. Container Archetype Classes
10. Deprecated Functions
11. Deprecated Macros
12. Deprecated Concept Checking Classes

### Macros

    #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.

### Basic Concept Checking Classes

    #include "boost/concept_check.hpp"

    template <class T>
    struct Integer; // Is T a built-in integer type?

    template <class T>
    struct SignedInteger; // Is T a built-in signed integer type?

    template <class T>
    struct UnsignedInteger; // Is T a built-in unsigned integer type?

    template <class X, class Y>
    struct Convertible; // Is X convertible to Y?

    template <class T>
    struct Assignable; // Standard ref 23.1

    template <class T>
    struct SGIAssignable;

    template <class T>
    struct DefaultConstructible;

    template <class T>
    struct CopyConstructible; // Standard ref 20.1.3

    template <class T>
    struct EqualityComparable; // Standard ref 20.1.1

    template <class T>
    struct LessThanComparable; // Standard ref 20.1.2

    template <class T>
    struct Comparable; // The SGI STL LessThanComparable concept

### Iterator Concept Checking Classes

    template <class Iter>
    struct InputIterator; // Standard ref 24.1.1 Table 72

    template <class Iter, class T>
    struct OutputIterator; // Standard ref 24.1.2 Table 73

    template <class Iter>
    struct ForwardIterator; // Standard ref 24.1.3 Table 74

    template <class Iter>
    struct Mutable_ForwardIterator;

    template <class Iter>
    struct BidirectionalIterator; // Standard ref 24.1.4 Table 75

    template <class Iter>
    struct Mutable_BidirectionalIterator;

    template <class Iter>
    struct RandomAccessIterator; // Standard ref 24.1.5 Table 76

    template <class Iter>
    struct Mutable_RandomAccessIterator;

### Function Object Concept Checking Classes

    #include "boost/concept_check.hpp"

    template <class Func, class Return>
    struct Generator;

    template <class Func, class Return, class Arg>
    struct UnaryFunction;

    template <class Func, class Return, class First, class Second>
    struct BinaryFunction;

    template <class Func, class Arg>
    struct UnaryPredicate;

    template <class Func, class First, class Second>
    struct BinaryPredicate;

    template <class Func, class First, class Second>
    struct Const_BinaryPredicate;

    template <class Func, class Return>
    struct AdaptableGenerator;

    template <class Func, class Return, class Arg>
    struct AdaptableUnaryFunction;

    template <class Func, class First, class Second>
    struct AdaptableBinaryFunction;

    template <class Func, class Arg>
    struct AdaptablePredicate;

    template <class Func, class First, class Second>
    struct AdaptableBinaryPredicate;

### Container Concept Checking Classes

    #include "boost/concept_check.hpp"

    template <class C>
    struct Container; // Standard ref 23.1 Table 65

    template <class C>
    struct Mutable_Container;

    template <class C>
    struct ForwardContainer;

    template <class C>
    struct Mutable_ForwardContainer;

    template <class C>
    struct ReversibleContainer; // Standard ref 23.1 Table 66

    template <class C>
    struct Mutable_ReversibleContainer;

    template <class C>
    struct RandomAccessContainer;

    template <class C>
    struct Mutable_RandomAccessContainer;

    template <class C>
    struct Sequence; // Standard ref 23.1.1

    template <class C>
    struct FrontInsertionSequence;

    template <class C>
    struct BackInsertionSequence;

    template <class C>
    struct AssociativeContainer; // Standard ref 23.1.2 Table 69

    template <class C>
    struct UniqueAssociativeContainer;

    template <class C>
    struct MultipleAssociativeContainer;

    template <class C>
    struct SimpleAssociativeContainer;

    template <class C>
    struct PairAssociativeContainer;

    template <class C>
    struct SortedAssociativeContainer;

    template <class C>
    struct Collection;

### Basic Archetype Classes

    #include "boost/concept_archetype.hpp"

    template <class T = int>
    class null_archetype; // A type that models no concepts.

    template <class Base = null_archetype>
    class default_constructible_archetype;

    template <class Base = null_archetype>
    class assignable_archetype;

    template <class Base = null_archetype>
    class copy_constructible_archetype;

    template <class Base = null_archetype>
    class equality_comparable_archetype;

    template <class T, class Base = null_archetype>
    class convertible_to_archetype;

### Iterator Archetype Classes

    #include "boost/concept_archetype.hpp"

    template <class ValueType>
    class trivial_iterator_archetype;

    template <class ValueType>
    class mutable_trivial_iterator_archetype;

    template <class ValueType>
    class input_iterator_archetype;

    template <class ValueType>
    class forward_iterator_archetype;

    template <class ValueType>
    class bidirectional_iterator_archetype;

    template <class ValueType>
    class random_access_iterator_archetype;

### Function Object Archetype Classes

    #include "boost/concept_archetype.hpp"

    template <class Arg, class Return>
    class unary_function_archetype;

    template <class Arg1, class Arg2, class Return>
    class binary_function_archetype;

    template <class Arg>
    class predicate_archetype;

    template <class Arg1, class Arg2>
    class binary_predicate_archetype;

### Container Archetype Classes

    UNDER CONSTRUCTION

### Deprecated Functions

    #include "boost/concept_check.hpp"

    template <class Concept>
    void function_requires();

### Deprecated Macros

    #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);

### Deprecated Concept Checking Classes

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.