~ubuntu-branches/ubuntu/dapper/boost/dapper

« back to all changes in this revision

Viewing changes to boost/detail/is_xxx.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Domenico Andreoli, Christophe Prud'homme, Domenico Andreoli
  • Date: 2006-01-11 11:11:42 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060111111142-xy6z1i5himlgu8iw
Tags: 1.33.1-2
[ Christophe Prud'homme ]
* Bug fix: "libboost-wave-dev: Dependency on libboost-filesystem-dev
  missing", thanks to Martin v . Löwis (Closes: #346367).

[ Domenico Andreoli ]
* boost/graph/topological_sort.hpp: removed name of unused parameter
  to prevent long compiler warning.  Closes: #347519.
* Applied patch from upstream CVS to fix parsing of valid options
  with a common root.  Closes: #345714.
* libboost-python-dev now correctly depends on python2.4-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
6
 
 
7
# include <boost/config.hpp>
 
8
# include <boost/mpl/bool.hpp>
 
9
# include <boost/preprocessor/enum_params.hpp>
 
10
 
 
11
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 
12
# include <boost/type_traits/is_reference.hpp>
 
13
# include <boost/type_traits/add_reference.hpp>
 
14
 
 
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];                                              \
 
21
                                                                        \
 
22
    static typename add_reference<X_>::type dummy;                      \
 
23
                                                                        \
 
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
        );                                                              \
 
30
                                                                        \
 
31
        template <class U>                                              \
 
32
        static no test(U&, ...);                                        \
 
33
    };                                                                  \
 
34
                                                                        \
 
35
    BOOST_STATIC_CONSTANT(                                              \
 
36
        bool, value                                                     \
 
37
        = !is_reference<X_>::value                                      \
 
38
        & (sizeof(helpers::test(dummy, 0)) == sizeof(yes)));            \
 
39
                                                                        \
 
40
    typedef mpl::bool_<value> type;                                     \
 
41
};
 
42
 
 
43
# else
 
44
 
 
45
#  define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs)  \
 
46
template <class T>                                              \
 
47
struct is_##name : mpl::false_                                  \
 
48
{                                                               \
 
49
};                                                              \
 
50
                                                                \
 
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
{                                                               \
 
57
};
 
58
 
 
59
# endif
 
60
 
 
61
#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP