]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/mpl/doc/src/refmanual/eval_if.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / eval_if.rst
CommitLineData
7c673cae
FG
1.. Metafunctions/Type Selection//eval_if |30
2
3eval_if
4=======
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11 template<
12 typename C
13 , typename F1
14 , typename F2
15 >
16 struct eval_if
17 {
18 typedef |unspecified| type;
19 };
20
21
22
23Description
24-----------
25
26Evaluates one of its two |nullary metafunction| arguments, ``F1`` or ``F2``, depending
27on the value ``C``.
28
29
30Header
31------
32
33.. parsed-literal::
34
35 #include <boost/mpl/eval_if.hpp>
36
37
38Parameters
39----------
40
41+---------------+-----------------------------------+-----------------------------------------------+
42| Parameter | Requirement | Description |
43+===============+===================================+===============================================+
44| ``C`` | |Integral Constant| | An evaluation condition. |
45+---------------+-----------------------------------+-----------------------------------------------+
46| ``F1``, ``F2``| Nullary |Metafunction| | Metafunctions to select for evaluation from. |
47+---------------+-----------------------------------+-----------------------------------------------+
48
49
50Expression semantics
51--------------------
52
53For any |Integral Constant| ``c`` and nullary |Metafunction|\ s ``f1``, ``f2``:
54
55
56.. parsed-literal::
57
58 typedef eval_if<c,f1,f2>::type t;
59
60:Return type:
61 Any type.
62
63:Semantics:
64 If ``c::value == true``, ``t`` is identical to ``f1::type``; otherwise ``t`` is
65 identical to ``f2::type``.
66
67
68Example
69-------
70
71.. parsed-literal::
72
73 typedef eval_if< true\_, identity<char>, identity<long> >::type t1;
74 typedef eval_if< false\_, identity<char>, identity<long> >::type t2;
75
76 BOOST_MPL_ASSERT(( is_same<t1,char> ));
77 BOOST_MPL_ASSERT(( is_same<t2,long> ));
78
79
80See also
81--------
82
83|Metafunctions|, |Integral Constant|, |eval_if_c|, |if_|
84
85
86