or_
template<
typename F1
, typename F2
, typename F3 = false_
...
, typename Fn = false_
>
struct or_
{
typedef unspecified type;
};
Returns the result of short-circuit logical or (||) operation on its arguments.
#include "boost/mpl/or.hpp"
| Parameter | Requirement | Description |
|---|---|---|
F1, F2, .., Fn | A model of nullary Metafunction |
| Expression | Expression type | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
typedef or_<f1,f2,..,fn>::type c; | A model of bool Integral Constant | Returns true_ if either of f1::type::value, f2::type::value, .., fn::type::value expressions evaluates to true, and false_ 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((or_< false_,true_ >::type::value == true)); BOOST_STATIC_ASSERT((or_< true_,fail<int> >::type::value == true)); // OK, fail<int> is never invoked BOOST_STATIC_ASSERT((or_< false_,true_,fail<int> >::type::value == true)); // OK too