1.. Metafunctions/Type Selection//eval_if_c |40
2
3eval_if_c
4=========
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          bool c
13        , typename F1
14        , typename F2
15        >
16    struct eval_if_c
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 of integral constant ``c``. ``eval_if_c<c,f1,f2>::type`` is a shorcut
28notation for ``eval_if< bool_<c>,f1,f2 >::type``.
29
30
31Header
32------
33
34.. parsed-literal::
35
36    #include <boost/mpl/eval_if.hpp>
37
38
39Parameters
40----------
41
42+---------------+-----------------------------------+-----------------------------------------------+
43| Parameter     | Requirement                       | Description                                   |
44+===============+===================================+===============================================+
45| ``c``         | An integral constant              | An evaluation condition.                      |
46+---------------+-----------------------------------+-----------------------------------------------+
47| ``F1``, ``F2``| Nullary |Metafunction|            | Metafunctions to select for evaluation from.  |
48+---------------+-----------------------------------+-----------------------------------------------+
49
50
51Expression semantics
52--------------------
53
54For any integral constant ``c`` and nullary |Metafunction|\ s ``f1``, ``f2``:
55
56
57.. parsed-literal::
58
59    typedef eval_if_c<c,f1,f2>::type t;
60
61:Return type:
62    Any type.
63
64:Semantics:
65    Equivalent to ``typedef eval_if< bool_<c>,f1,f2 >::type t;``
66
67
68Example
69-------
70
71.. parsed-literal::
72
73    typedef eval_if_c< true, identity<char>, identity<long> >::type t1;
74    typedef eval_if_c< 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|, |if_|, |bool_|
84
85
86.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
87   Distributed under the Boost Software License, Version 1.0. (See accompanying
88   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
89