1 /*============================================================================= 2 Copyright (c) 2001-2014 Joel de Guzman 3 4 Distributed under the Boost Software License, Version 1.0. (See accompanying 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 ==============================================================================*/ 7 #if !defined(FUSION_RESULT_OF_10272014_0654) 8 #define FUSION_RESULT_OF_10272014_0654 9 10 #include <boost/config.hpp> 11 #include <boost/utility/result_of.hpp> 12 13 #if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) 14 #define BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF 15 #endif 16 17 #if !defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) 18 #include <boost/mpl/if.hpp> 19 #include <boost/mpl/or.hpp> 20 #include <boost/mpl/has_xxx.hpp> 21 #endif 22 23 namespace boost { namespace fusion { namespace detail 24 { 25 // This is a temporary workaround for result_of before we make fusion fully 26 // sfinae result_of friendy, which will require some heavy lifting for some 27 // low level code. So far this is used only in the fold algorithm. This will 28 // be removed once we overhaul fold. 29 30 #if defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) 31 32 template <typename Sig> 33 struct result_of_with_decltype : boost::tr1_result_of<Sig> {}; 34 35 #else // defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) 36 37 BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) 38 BOOST_MPL_HAS_XXX_TEMPLATE_DEF(result) 39 40 template <typename Sig> 41 struct result_of_with_decltype; 42 43 template <typename F, typename... Args> 44 struct result_of_with_decltype<F(Args...)> 45 : mpl::if_<mpl::or_<has_result_type<F>, detail::has_result<F> >, 46 boost::tr1_result_of<F(Args...)>, 47 boost::detail::cpp0x_result_of<F(Args...)> >::type {}; 48 49 #endif // defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) 50 51 }}} 52 53 #endif 54