Ticket #7343: ean_result_of_sfinae.patch
File ean_result_of_sfinae.patch, 2.4 KB (added by , 10 years ago) |
---|
-
boost/utility/detail/result_of_iterate.hpp
60 60 61 61 template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) 62 62 BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> 63 struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))> 63 struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), 64 typename result_of_always_void<decltype( 65 boost::declval<F>()( 66 BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), declval<T, >() BOOST_PP_INTERCEPT) 67 ) 68 )>::type> 64 69 { 65 70 typedef decltype( 66 71 boost::declval<F>()( -
boost/utility/result_of.hpp
56 56 #if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) 57 57 namespace detail { 58 58 59 template<typename T> 60 struct result_of_always_void 61 { 62 typedef void type; 63 }; 64 59 65 BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) 60 66 61 67 template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl; 62 template<typename F > struct cpp0x_result_of_impl;68 template<typename F, typename Enable = void> struct cpp0x_result_of_impl {}; 63 69 64 70 template<typename F> 65 71 struct result_of_void_impl -
libs/utility/test/result_of_test.cpp
129 129 #endif 130 130 }; 131 131 132 // sfinae_tests are derived from example code from Joel de Guzman, 133 // which demonstrated the interaction between result_of and SFINAE. 134 template <typename F, typename Arg> 135 typename boost::result_of<F(Arg const&)>::type 136 sfinae_test(F f, Arg const& arg) 137 { 138 return f(arg); 139 } 140 141 template <typename F, typename Arg> 142 typename boost::result_of<F(Arg&)>::type 143 sfinae_test(F f, Arg& arg) 144 { 145 return f(arg); 146 } 147 148 int sfinae_test_f(int& i) 149 { 150 return i; 151 } 152 132 153 struct X {}; 133 154 134 155 int main() … … 268 289 #endif 269 290 #endif 270 291 292 #if defined(BOOST_RESULT_OF_USE_DECLTYPE) 293 int i = 123; 294 sfinae_test(sfinae_test_f, i); 295 #endif // defined(BOOST_RESULT_OF_USE_DECLTYPE) 296 271 297 return 0; 272 298 }