williamr@2
|
1 |
|
williamr@2
|
2 |
#ifndef BOOST_MPL_EVAL_IF_HPP_INCLUDED
|
williamr@2
|
3 |
#define BOOST_MPL_EVAL_IF_HPP_INCLUDED
|
williamr@2
|
4 |
|
williamr@2
|
5 |
// Copyright Aleksey Gurtovoy 2000-2004
|
williamr@2
|
6 |
//
|
williamr@2
|
7 |
// Distributed under the Boost Software License, Version 1.0.
|
williamr@2
|
8 |
// (See accompanying file LICENSE_1_0.txt or copy at
|
williamr@2
|
9 |
// http://www.boost.org/LICENSE_1_0.txt)
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// See http://www.boost.org/libs/mpl for documentation.
|
williamr@2
|
12 |
|
williamr@2
|
13 |
// $Source: /cvsroot/boost/boost/boost/mpl/eval_if.hpp,v $
|
williamr@2
|
14 |
// $Date: 2004/11/28 01:54:10 $
|
williamr@2
|
15 |
// $Revision: 1.3 $
|
williamr@2
|
16 |
|
williamr@2
|
17 |
#include <boost/mpl/if.hpp>
|
williamr@2
|
18 |
#include <boost/mpl/aux_/na_spec.hpp>
|
williamr@2
|
19 |
#include <boost/mpl/aux_/lambda_support.hpp>
|
williamr@2
|
20 |
#include <boost/mpl/aux_/config/msvc.hpp>
|
williamr@2
|
21 |
#include <boost/mpl/aux_/config/gcc.hpp>
|
williamr@2
|
22 |
#include <boost/mpl/aux_/config/workaround.hpp>
|
williamr@2
|
23 |
|
williamr@2
|
24 |
namespace boost { namespace mpl {
|
williamr@2
|
25 |
|
williamr@2
|
26 |
template<
|
williamr@2
|
27 |
typename BOOST_MPL_AUX_NA_PARAM(C)
|
williamr@2
|
28 |
, typename BOOST_MPL_AUX_NA_PARAM(F1)
|
williamr@2
|
29 |
, typename BOOST_MPL_AUX_NA_PARAM(F2)
|
williamr@2
|
30 |
>
|
williamr@2
|
31 |
struct eval_if
|
williamr@2
|
32 |
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|
williamr@2
|
33 |
|| ( BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, >= 0x0300) \
|
williamr@2
|
34 |
&& BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0304)) \
|
williamr@2
|
35 |
)
|
williamr@2
|
36 |
{
|
williamr@2
|
37 |
typedef typename if_<C,F1,F2>::type f_;
|
williamr@2
|
38 |
typedef typename f_::type type;
|
williamr@2
|
39 |
#else
|
williamr@2
|
40 |
: if_<C,F1,F2>::type
|
williamr@2
|
41 |
{
|
williamr@2
|
42 |
#endif
|
williamr@2
|
43 |
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,eval_if,(C,F1,F2))
|
williamr@2
|
44 |
};
|
williamr@2
|
45 |
|
williamr@2
|
46 |
// (almost) copy & paste in order to save one more
|
williamr@2
|
47 |
// recursively nested template instantiation to user
|
williamr@2
|
48 |
template<
|
williamr@2
|
49 |
bool C
|
williamr@2
|
50 |
, typename F1
|
williamr@2
|
51 |
, typename F2
|
williamr@2
|
52 |
>
|
williamr@2
|
53 |
struct eval_if_c
|
williamr@2
|
54 |
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|
williamr@2
|
55 |
|| ( BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, >= 0x0300) \
|
williamr@2
|
56 |
&& BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0304)) \
|
williamr@2
|
57 |
)
|
williamr@2
|
58 |
{
|
williamr@2
|
59 |
typedef typename if_c<C,F1,F2>::type f_;
|
williamr@2
|
60 |
typedef typename f_::type type;
|
williamr@2
|
61 |
#else
|
williamr@2
|
62 |
: if_c<C,F1,F2>::type
|
williamr@2
|
63 |
{
|
williamr@2
|
64 |
#endif
|
williamr@2
|
65 |
};
|
williamr@2
|
66 |
|
williamr@2
|
67 |
BOOST_MPL_AUX_NA_SPEC(3, eval_if)
|
williamr@2
|
68 |
|
williamr@2
|
69 |
}}
|
williamr@2
|
70 |
|
williamr@2
|
71 |
#endif // BOOST_MPL_EVAL_IF_HPP_INCLUDED
|