logical_and
template<
typename F1
, typename F2
, typename F3 = true_c
...
, typename Fn = true_c
>
struct logical_and
{
typedef unspecified type;
};
Returns the result of short-circuit logical and (&&) operation on its arguments.
#include "boost/mpl/logical/and.hpp"
| Parameter | Requirement | Description |
|---|---|---|
F1, F2, .., Fn | A model of nullary Metafunction |
| Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|
typedef logical_and<f1,f2,..,fn>::type c; | Returns false_c if either of f1::type::value, f2::type::value, .., fn::type::value expressions evaluates to false, and true_c otherwise; guarantees left-to-right evaluation; moreover, the operands subsequent to the first fi metafunction that evaluates to false 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_and< true_c,false_c >::type::value == false)); BOOST_STATIC_ASSERT((logical_and< false_c,fail<int> >::type::value == false)); // ok, fail<int> is never invoked BOOST_STATIC_ASSERT((logical_and< true_c,false_c,fail<int> >::type::value == false)); // ok too
Metafunctions, logical_or, logical_not