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