...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::contract::call_if — Select compilation and execution of functor template calls using a nullary boolean meta-function (not needed on C++17 compilers, use if constexpr
instead).
// In header: <boost/contract/call_if.hpp> template<typename Pred, typename Then> call_if_statement< Pred::value, Then > call_if(Then f);
This is equivalent to boost::contract::call_if_c<Pred::value>(f)
. Create a call-if object with the specified then-branch functor template:
boost::contract::call_if<Pred1>( then_functor_template1 ).template else_if<Pred2>( // Optional. then_functor_template2 ) // Optionally, other `else_if` or ... // `else_if_c`. .else_( // Optional for `void` functors, else_functor_template // but required for non `void`. )
Optional functor templates for else-if-branches and the else-branch can be specified as needed (the else-branch functor template is required if f
returns non-void).
See Also:
Parameters: |
|
||
Template Parameters: |
|
||
Returns: |
A call-if statement so else and else-if statements can be specified if needed. Eventually, this will be the return value of the one functor template call being compiled and executed (which could also be |