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

PrevUpHomeNext

Composing Concepts

(For the source of the examples in this section see compose.cpp)

Multiple concepts can be composed using an MPL sequence.

template<class T = _self>
struct arithmetic :
    mpl::vector<
        copy_constructible<T>,
        addable<T>,
        subtractable<T>,
        multipliable<T>,
        dividable<T>,
        equality_comparable<T>,
        less_than_comparable<T>
    >
{};

Now, arithmetic is a concept that can be used just like any of the base concepts.


PrevUpHomeNext