Boost logo

Boost :

Subject: [boost] [concept] "not" and "or" concept constraints (N2081)
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2010-05-28 11:31:09


Hello all,

How can I use Boost.ConceptCheck to implement "not" and "or" concept
constraints as they are defined in N2081?
(If this is obvious from the documentation, please just point me to the link.)

For example, how can I program the following code from N2081 using
Boost.ConceptCheck:

    // "not" `!` concept constraint for some concept C (not C++ code).
    template<Regular T> where !C<T> void f(T x) { ... }

    // "or" `||` concept constraint (not C++ code).
    template<Regular T> where Integral<T> || Floating<T> T cos(T x) { ... }

If I understand it right, I can program the "and" concept constraints
in Boost.ConceptCheck just by specifying multiple concepts as in:

    // "and" `&&` concept constraint.
    template<typename T>
        BOOST_CONCEPT_REQUIRES( ((boost::Integral<T>)) ((boost::
Arithmetic<T>)),
    T) f(T x) { ... }

But how do I use BOOST_CONCEPT_REQUIRES(), etc to program "not" and
"or" concept constraints?

Thank you very much.

-- 
Lorenzo

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk