Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Concept Checking

Each of the range concepts has a corresponding concept checking class in the file <boost/range/concepts.hpp>. These classes may be used in conjunction with the Boost Concept Check library to ensure that the type of a template parameter is compatible with a range concept. If not, a meaningful compile time error is generated. Checks are provided for the range concepts related to iterator traversal categories. For example, the following line checks that the type T models the Forward Range concept.

BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<T> ));

An additional concept check is required for the value access property of the range based on the range's iterator type. For example to check for a ForwardReadableRange, the following code is required.

BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<T> ));
BOOST_CONCEPT_ASSERT(( ReadableIteratorConcept<typename range_iterator<T>::type> ));

The following range concept checking classes are provided.

See also

Range Terminology and style guidelines

Iterator concepts

Boost Concept Check library


PrevUpHomeNext