Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

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 
struct 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

Iterator Concept Checking Classes

template 
struct 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;

Function Object Concept Checking Classes

#include "boost/concept_check.hpp"

template 
struct 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;

Container Concept Checking Classes

#include "boost/concept_check.hpp"

template 
struct 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;

Basic Archetype Classes

#include "boost/concept_archetype.hpp"

template 
class 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;

Iterator Archetype Classes

#include "boost/concept_archetype.hpp"

template 
class 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;

Function Object Archetype Classes

#include "boost/concept_archetype.hpp"

template 
class unary_function_archetype;

template 
class binary_function_archetype;

template 
class predicate_archetype;

template 
class binary_predicate_archetype;

Container Archetype Classes

UNDER CONSTRUCTION

Deprecated Functions

#include "boost/concept_check.hpp"

template 
void function_requires();

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

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.