File indexing completed on 2025-01-18 09:53:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #if !defined(BOOST_PP_IS_ITERATING)
0015 # error Boost result_of - do not include this file!
0016 #endif
0017
0018
0019 #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0
0020 # define BOOST_RESULT_OF_ARGS void
0021 #else
0022 # define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)
0023 #endif
0024
0025 #if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
0026 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0027 struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
0028 : conditional<
0029 is_pointer<F>::value || is_member_function_pointer<F>::value
0030 , boost::detail::tr1_result_of_impl<
0031 typename remove_cv<F>::type,
0032 typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
0033 (boost::detail::result_of_has_result_type<F>::value)>
0034 , boost::detail::tr1_result_of_impl<
0035 F,
0036 F(BOOST_RESULT_OF_ARGS),
0037 (boost::detail::result_of_has_result_type<F>::value)> >::type { };
0038 #endif
0039
0040 #ifdef BOOST_RESULT_OF_USE_DECLTYPE
0041 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0042 struct result_of<F(BOOST_RESULT_OF_ARGS)>
0043 : detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> { };
0044 #endif
0045
0046 #ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
0047 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0048 struct result_of<F(BOOST_RESULT_OF_ARGS)>
0049 : conditional<detail::result_of_has_result_type<F>::value || detail::result_of_has_result<F>::value,
0050 tr1_result_of<F(BOOST_RESULT_OF_ARGS)>,
0051 detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> >::type { };
0052 #endif
0053
0054 #if defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
0055
0056 namespace detail {
0057
0058 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0059 struct cpp0x_result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
0060 : conditional<
0061 is_member_function_pointer<F>::value
0062 , detail::tr1_result_of_impl<
0063 typename remove_cv<F>::type,
0064 typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
0065 >
0066 , detail::cpp0x_result_of_impl<
0067 F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))
0068 >
0069 >::type
0070 {};
0071
0072 #ifdef BOOST_NO_SFINAE_EXPR
0073
0074 template<typename F>
0075 struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION());
0076
0077 template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
0078 struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<R(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))> {
0079 R operator()(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)) const;
0080 typedef result_of_private_type const &(*pfn_t)(...);
0081 operator pfn_t() const volatile;
0082 };
0083
0084 template<typename F>
0085 struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())
0086 : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F>
0087 {};
0088
0089 template<typename F>
0090 struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F *>
0091 : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F>
0092 {};
0093
0094 template<typename F>
0095 struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())
0096 : conditional<
0097 is_class<typename remove_reference<F>::type>::value,
0098 result_of_wrap_callable_class<F>,
0099 type_identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<typename remove_reference<F>::type>::type> >
0100 >::type
0101 {};
0102
0103 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
0104 struct BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION()) {
0105 typedef typename BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())<F>::type wrapper_t;
0106 static const bool value = (
0107 sizeof(result_of_no_type) == sizeof(detail::result_of_is_private_type(
0108 (boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), result_of_weird_type())
0109 ))
0110 );
0111 typedef integral_constant<bool, value> type;
0112 };
0113
0114 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0115 struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), true>
0116 : lazy_enable_if<
0117 BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION())<F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), T)>
0118 , cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false>
0119 >
0120 {};
0121
0122 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0123 struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false>
0124 {
0125 typedef decltype(
0126 boost::declval<F>()(
0127 BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
0128 )
0129 ) type;
0130 };
0131
0132 #else
0133
0134 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0135 struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)),
0136 typename result_of_always_void<decltype(
0137 boost::declval<F>()(
0138 BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
0139 )
0140 )>::type> {
0141 typedef decltype(
0142 boost::declval<F>()(
0143 BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)
0144 )
0145 ) type;
0146 };
0147
0148 #endif
0149
0150 }
0151
0152 #else
0153
0154 #if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
0155 template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0156 struct result_of<F(BOOST_RESULT_OF_ARGS)>
0157 : tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { };
0158 #endif
0159
0160 #endif
0161
0162 #undef BOOST_RESULT_OF_ARGS
0163
0164 #if BOOST_PP_ITERATION() >= 1
0165
0166 namespace detail {
0167
0168 template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0169 struct tr1_result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
0170 {
0171 typedef R type;
0172 };
0173
0174 template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0175 struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
0176 {
0177 typedef R type;
0178 };
0179
0180 #if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
0181 template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0182 struct tr1_result_of_impl<R (T0::*)
0183 (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),
0184 FArgs, false>
0185 {
0186 typedef R type;
0187 };
0188
0189 template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0190 struct tr1_result_of_impl<R (T0::*)
0191 (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
0192 const,
0193 FArgs, false>
0194 {
0195 typedef R type;
0196 };
0197
0198 template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0199 struct tr1_result_of_impl<R (T0::*)
0200 (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
0201 volatile,
0202 FArgs, false>
0203 {
0204 typedef R type;
0205 };
0206
0207 template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
0208 struct tr1_result_of_impl<R (T0::*)
0209 (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T))
0210 const volatile,
0211 FArgs, false>
0212 {
0213 typedef R type;
0214 };
0215 #endif
0216
0217 }
0218 #endif