Boost logo

Boost :

Subject: [boost] [contract] static if instead of assertion requirements
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2012-10-02 17:32:36

Hello all,

I was reading the proposal to add "static if" to C++1x and I will use
such a syntax for assertion requirements:

Current syntax for assertion requirements:

        back() == value, requires boost::has_equal<T>::value

Will be replaced with static if:

        static if(boost::has_equal<T>::value) (
            back() == value
        ) // optional else ( ... )

If there were interested, I could even provide a separate
BOOST_STATIC_IF(const_condition, then_code, else_code)... however,
such a macro could only be used at namespace and class scope, not a
function scope :(


Boost list run by bdawes at, gregod at, cpdaniel at, john at