File indexing completed on 2025-01-30 09:44:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_LAMBDA_IS_INSTANCE_OF
0014 #define BOOST_LAMBDA_IS_INSTANCE_OF
0015
0016 #include "boost/config.hpp" // for BOOST_STATIC_CONSTANT
0017 #include "boost/type_traits/conversion_traits.hpp" // for is_convertible
0018 #include "boost/preprocessor/enum_shifted_params.hpp"
0019 #include "boost/preprocessor/repeat_2nd.hpp"
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #define BOOST_LAMBDA_CLASS(z, N,A) BOOST_PP_COMMA_IF(N) class
0042 #define BOOST_LAMBDA_CLASS_ARG(z, N,A) BOOST_PP_COMMA_IF(N) class A##N
0043 #define BOOST_LAMBDA_ARG(z, N,A) BOOST_PP_COMMA_IF(N) A##N
0044
0045 #define BOOST_LAMBDA_CLASS_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS, NAME)
0046
0047 #define BOOST_LAMBDA_CLASS_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS_ARG, NAME)
0048
0049 #define BOOST_LAMBDA_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_ARG, NAME)
0050
0051 namespace boost {
0052 namespace lambda {
0053
0054 #define BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE(INDEX) \
0055 \
0056 namespace detail { \
0057 \
0058 template <template<BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class F> \
0059 struct BOOST_PP_CAT(conversion_tester_,INDEX) { \
0060 template<BOOST_LAMBDA_CLASS_ARG_LIST(INDEX,A)> \
0061 BOOST_PP_CAT(conversion_tester_,INDEX) \
0062 (const F<BOOST_LAMBDA_ARG_LIST(INDEX,A)>&); \
0063 }; \
0064 \
0065 } \
0066 \
0067 template <class From, template <BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class To> \
0068 struct BOOST_PP_CAT(is_instance_of_,INDEX) \
0069 { \
0070 private: \
0071 typedef ::boost::is_convertible< \
0072 From, \
0073 BOOST_PP_CAT(detail::conversion_tester_,INDEX)<To> \
0074 > helper_type; \
0075 \
0076 public: \
0077 BOOST_STATIC_CONSTANT(bool, value = helper_type::value); \
0078 };
0079
0080
0081 #define BOOST_LAMBDA_HELPER(z, N, A) BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE( BOOST_PP_INC(N) )
0082
0083
0084
0085 BOOST_PP_REPEAT_2ND(4,BOOST_LAMBDA_HELPER,FOO)
0086
0087 #undef BOOST_LAMBDA_HELPER
0088 #undef BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE
0089 #undef BOOST_LAMBDA_CLASS
0090 #undef BOOST_LAMBDA_ARG
0091 #undef BOOST_LAMBDA_CLASS_ARG
0092 #undef BOOST_LAMBDA_CLASS_LIST
0093 #undef BOOST_LAMBDA_ARG_LIST
0094 #undef BOOST_LAMBDA_CLASS_ARG_LIST
0095
0096 }
0097 }
0098
0099 #endif
0100
0101
0102
0103
0104