sl@0
|
1 |
// Copyright David Abrahams 2005. Distributed under the Boost
|
sl@0
|
2 |
// Software License, Version 1.0. (See accompanying
|
sl@0
|
3 |
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
4 |
#ifndef BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
sl@0
|
5 |
# define BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
sl@0
|
6 |
|
sl@0
|
7 |
# include <boost/config.hpp>
|
sl@0
|
8 |
# include <boost/mpl/bool.hpp>
|
sl@0
|
9 |
# include <boost/preprocessor/enum_params.hpp>
|
sl@0
|
10 |
|
sl@0
|
11 |
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
sl@0
|
12 |
# include <boost/type_traits/is_reference.hpp>
|
sl@0
|
13 |
# include <boost/type_traits/add_reference.hpp>
|
sl@0
|
14 |
|
sl@0
|
15 |
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
|
sl@0
|
16 |
template <class X_> \
|
sl@0
|
17 |
struct is_##name \
|
sl@0
|
18 |
{ \
|
sl@0
|
19 |
typedef char yes; \
|
sl@0
|
20 |
typedef char (&no)[2]; \
|
sl@0
|
21 |
\
|
sl@0
|
22 |
static typename add_reference<X_>::type dummy; \
|
sl@0
|
23 |
\
|
sl@0
|
24 |
struct helpers \
|
sl@0
|
25 |
{ \
|
sl@0
|
26 |
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \
|
sl@0
|
27 |
static yes test( \
|
sl@0
|
28 |
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \
|
sl@0
|
29 |
); \
|
sl@0
|
30 |
\
|
sl@0
|
31 |
template <class U> \
|
sl@0
|
32 |
static no test(U&, ...); \
|
sl@0
|
33 |
}; \
|
sl@0
|
34 |
\
|
sl@0
|
35 |
BOOST_STATIC_CONSTANT( \
|
sl@0
|
36 |
bool, value \
|
sl@0
|
37 |
= !is_reference<X_>::value \
|
sl@0
|
38 |
& (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \
|
sl@0
|
39 |
\
|
sl@0
|
40 |
typedef mpl::bool_<value> type; \
|
sl@0
|
41 |
};
|
sl@0
|
42 |
|
sl@0
|
43 |
# else
|
sl@0
|
44 |
|
sl@0
|
45 |
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
|
sl@0
|
46 |
template <class T> \
|
sl@0
|
47 |
struct is_##name : mpl::false_ \
|
sl@0
|
48 |
{ \
|
sl@0
|
49 |
}; \
|
sl@0
|
50 |
\
|
sl@0
|
51 |
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \
|
sl@0
|
52 |
struct is_##name< \
|
sl@0
|
53 |
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \
|
sl@0
|
54 |
> \
|
sl@0
|
55 |
: mpl::true_ \
|
sl@0
|
56 |
{ \
|
sl@0
|
57 |
};
|
sl@0
|
58 |
|
sl@0
|
59 |
# endif
|
sl@0
|
60 |
|
sl@0
|
61 |
#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|