Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 // Boost Lambda Library - is_instance_of.hpp ---------------------
3 // Copyright (C) 2001 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see www.boost.org
11 // ---------------------------------------------------------------
13 #ifndef BOOST_LAMBDA_IS_INSTANCE_OF
14 #define BOOST_LAMBDA_IS_INSTANCE_OF
16 #include "boost/config.hpp" // for BOOST_STATIC_CONSTANT
17 #include "boost/type_traits/conversion_traits.hpp" // for is_convertible
18 #include "boost/preprocessor/enum_shifted_params.hpp"
19 #include "boost/preprocessor/repeat_2nd.hpp"
21 // is_instance_of --------------------------------
23 // is_instance_of_n<A, B>::value is true, if type A is
24 // an instantiation of a template B, or A derives from an instantiation
27 // n is the number of template arguments for B
30 // is_instance_of_2<std::istream, basic_stream>::value == true
32 // The original implementation was somewhat different, with different versions
33 // for different compilers. However, there was still a problem
34 // with gcc.3.0.2 and 3.0.3 compilers, which didn't think regard
35 // is_instance_of_N<...>::value was a constant.
36 // John Maddock suggested the way around this problem by building
37 // is_instance_of templates using boost::is_convertible.
38 // Now we only have one version of is_instance_of templates, which delagate
39 // all the nasty compiler tricks to is_convertible.
41 #define BOOST_LAMBDA_CLASS(z, N,A) BOOST_PP_COMMA_IF(N) class
42 #define BOOST_LAMBDA_CLASS_ARG(z, N,A) BOOST_PP_COMMA_IF(N) class A##N
43 #define BOOST_LAMBDA_ARG(z, N,A) BOOST_PP_COMMA_IF(N) A##N
45 #define BOOST_LAMBDA_CLASS_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS, NAME)
47 #define BOOST_LAMBDA_CLASS_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS_ARG, NAME)
49 #define BOOST_LAMBDA_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_ARG, NAME)
54 #define BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE(INDEX) \
58 template <template<BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class F> \
59 struct BOOST_PP_CAT(conversion_tester_,INDEX) { \
60 template<BOOST_LAMBDA_CLASS_ARG_LIST(INDEX,A)> \
61 BOOST_PP_CAT(conversion_tester_,INDEX) \
62 (const F<BOOST_LAMBDA_ARG_LIST(INDEX,A)>&); \
67 template <class From, template <BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class To> \
68 struct BOOST_PP_CAT(is_instance_of_,INDEX) \
71 typedef ::boost::is_convertible< \
73 BOOST_PP_CAT(detail::conversion_tester_,INDEX)<To> \
77 BOOST_STATIC_CONSTANT(bool, value = helper_type::value); \
81 #define BOOST_LAMBDA_HELPER(z, N, A) BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE( BOOST_PP_INC(N) )
83 // Generate the traits for 1-4 argument templates
85 BOOST_PP_REPEAT_2ND(4,BOOST_LAMBDA_HELPER,FOO)
87 #undef BOOST_LAMBDA_HELPER
88 #undef BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE
89 #undef BOOST_LAMBDA_CLASS
90 #undef BOOST_LAMBDA_ARG
91 #undef BOOST_LAMBDA_CLASS_ARG
92 #undef BOOST_LAMBDA_CLASS_LIST
93 #undef BOOST_LAMBDA_ARG_LIST
94 #undef BOOST_LAMBDA_CLASS_ARG_LIST