Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

[Home]or_

Synopsis

template< 
      typename F1
    , typename F2
    , typename F3 = false_
    ...
    , typename Fn = false_
    >
struct or_
{
    typedef unspecified type;
};

Description

Returns the result of short-circuit logical or (||) operation on its arguments.

Definition

#include "boost/mpl/or.hpp"

Parameters

 Parameter  Requirement  Description  
F1, F2, .., FnA model of nullary Metafunction

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
or_<f1,f2,..,fn>A model of bool Integral Constanttrue_ 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.

Example

// 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_ >::value == true)); BOOST_STATIC_ASSERT((or_< true_,fail<int> >::value == true)); // OK, fail<int> is never invoked BOOST_STATIC_ASSERT((or_< false_,true_,fail<int> >::value == true)); // OK too

See also

Metafunctions, and_, not_


Table of Contents
Last edited September 6, 2003 3:14 am