• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Metafunctions/Logical Operations//or_ |20
2
3or\_
4====
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename F1
13        , typename F2
14        |...|
15        , typename F\ *n* = |unspecified|
16        >
17    struct or\_
18    {
19        typedef |unspecified| type;
20    };
21
22
23
24Description
25-----------
26
27Returns the result of short-circuit *logical or* (``||``) operation on its arguments.
28
29
30Header
31------
32
33.. parsed-literal::
34
35    #include <boost/mpl/or.hpp>
36    #include <boost/mpl/logical.hpp>
37
38
39Parameters
40----------
41
42+---------------+---------------------------+-----------------------------------------------+
43| Parameter     | Requirement               | Description                                   |
44+===============+===========================+===============================================+
45| |F1...Fn|     | Nullary |Metafunction|    | Operation's arguments.                        |
46+---------------+---------------------------+-----------------------------------------------+
47
48
49Expression semantics
50--------------------
51
52For arbitrary nullary |Metafunction|\ s |f1...fn|:
53
54.. parsed-literal::
55
56    typedef or_<f1,f2,\ |...|\ ,f\ *n*\>::type r;
57
58:Return type:
59    |Integral Constant|.
60
61:Semantics:
62    ``r`` is ``true_`` if either of ``f1::type::value``, ``f2::type::value``,...
63    ``fn::type::value`` expressions evaluates to ``true``, and ``false_`` otherwise;
64    guarantees left-to-right evaluation; the operands subsequent to the first
65    ``f``\ *i* metafunction that evaluates to ``true`` are not evaluated.
66
67.. ..........................................................................
68
69.. parsed-literal::
70
71    typedef or_<f1,f2,\ |...|\ ,f\ *n*\> r;
72
73:Return type:
74    |Integral Constant|.
75
76:Semantics:
77    Equivalent to
78
79    .. parsed-literal::
80
81        struct r : or_<f1,f2,\ |...|\ ,f\ *n*\>::type {};
82
83
84Example
85-------
86
87.. parsed-literal::
88
89    struct unknown;
90
91    BOOST_MPL_ASSERT(( or_< true\_,true\_ > ));
92    BOOST_MPL_ASSERT(( or_< false\_,true\_ > ));
93    BOOST_MPL_ASSERT(( or_< true\_,false\_ > ));
94    BOOST_MPL_ASSERT_NOT(( or_< false\_,false\_ > ));
95    BOOST_MPL_ASSERT(( or_< true\_,unknown > )); // OK
96    BOOST_MPL_ASSERT(( or_< true\_,unknown,unknown > )); // OK too
97
98
99See also
100--------
101
102|Metafunctions|, |Logical Operations|, |and_|, |not_|
103
104
105.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
106   Distributed under the Boost Software License, Version 1.0. (See accompanying
107   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
108