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