From fb2f110eb4913b5df19e55f950317143efe7c11f Mon Sep 17 00:00:00 2001 From: morinmorin Date: Wed, 20 Sep 2017 23:37:39 +0900 Subject: [PATCH 1/2] Fix result_of_is_callable to support references to function pointers. On compilers without the support of expression SFINAE, decltype-based result_of failed to compile (FP is a function pointer type). --- include/boost/utility/detail/result_of_iterate.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/boost/utility/detail/result_of_iterate.hpp b/include/boost/utility/detail/result_of_iterate.hpp index 5192172..cd21ed6 100644 --- a/include/boost/utility/detail/result_of_iterate.hpp +++ b/include/boost/utility/detail/result_of_iterate.hpp @@ -82,15 +82,12 @@ struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION()) -struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION()); - -template -struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION()) +struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION()) : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION()) {}; template -struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION()) +struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION()) : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION()) {}; @@ -99,7 +96,7 @@ struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION()) : mpl::eval_if< is_class::type>, result_of_wrap_callable_class, - mpl::identity::type> > + mpl::identity::type>::type> > > {}; From 81ce4693f67657c61c4d872297ec019fb4d58893 Mon Sep 17 00:00:00 2001 From: morinmorin Date: Wed, 20 Sep 2017 23:44:35 +0900 Subject: [PATCH 2/2] Add tests for result_of in C++11. --- test/result_of_test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/result_of_test.cpp b/test/result_of_test.cpp index 9ea72f1..290043b 100644 --- a/test/result_of_test.cpp +++ b/test/result_of_test.cpp @@ -297,6 +297,12 @@ int main() BOOST_STATIC_ASSERT((is_same(void)>::type, cv_overload_check >::value)); BOOST_STATIC_ASSERT((is_same(void)>::type, cv_overload_check >::value)); BOOST_STATIC_ASSERT((is_same(void)>::type, cv_overload_check >::value)); + + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) BOOST_STATIC_ASSERT((is_same::type, short>::value)); BOOST_STATIC_ASSERT((is_same::type, int>::value));