template< typename F1 , typename F2 , typename F3 = false_c ... , typename Fn = false_c > struct logical_or { typedef unspecified type; };
Returns the result of short-circuit logical or (||
) operation on its arguments.
#include "boost/mpl/logical/or.hpp"
Parameter | Requirement | Description |
---|---|---|
F1, F2, .., Fn | A model of nullary Metafunction |
Expression | Expression type | Precondition | Semantics | Postcondition |
---|---|---|---|---|
typedef logical_or<f1,f2,..,fn>::type c; | A model of bool Integral Constant | Returns true_c if either of f1::type::value, f2::type::value, .., fn::type::value expressions evaluates to true, and false_c otherwise; guarantees left-to-right evaluation; moreover, the operands subsequent to the first fi metafunction that evaluates to true are not evaluated. |
// will generate compile-time error if invoked with T == any fundamental type template< typename T > struct fail { typedef typename T::nonexistent type; };BOOST_STATIC_ASSERT((logical_or< false_c,true_c >::type::value == true)); BOOST_STATIC_ASSERT((logical_or< true_c,fail<int> >::type::value == true)); // ok, fail<int> is never invoked BOOST_STATIC_ASSERT((logical_or< false_c,true_c,fail<int> >::type::value == true)); // ok too
Metafunctions, logical_and
, logical_not