1 // Boost result_of library
\r
3 // Copyright Douglas Gregor 2004. Use, modification and
\r
4 // distribution is subject to the Boost Software License, Version
\r
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
\r
6 // http://www.boost.org/LICENSE_1_0.txt)
\r
8 // For more information, see http://www.boost.org/libs/utility
\r
9 #ifndef BOOST_RESULT_OF_HPP
\r
10 #define BOOST_RESULT_OF_HPP
\r
12 #include <boost/config.hpp>
\r
13 #include <boost/type_traits/ice.hpp>
\r
14 #include <boost/type.hpp>
\r
15 #include <boost/preprocessor.hpp>
\r
16 #include <boost/detail/workaround.hpp>
\r
17 #include <boost/mpl/has_xxx.hpp>
\r
18 #include <boost/mpl/if.hpp>
\r
19 #include <boost/mpl/bool.hpp>
\r
21 #ifndef BOOST_RESULT_OF_NUM_ARGS
\r
22 # define BOOST_RESULT_OF_NUM_ARGS 10
\r
27 template<typename F> struct result_of;
\r
29 #if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
32 BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
\r
34 template<typename F, typename FArgs, bool HasResultType> struct result_of_impl;
\r
36 template<typename F>
\r
37 struct result_of_void_impl
\r
42 template<typename R>
\r
43 struct result_of_void_impl<R (*)(void)>
\r
48 template<typename R>
\r
49 struct result_of_void_impl<R (&)(void)>
\r
54 template<typename F, typename FArgs>
\r
55 struct result_of_impl<F, FArgs, true>
\r
57 typedef typename F::result_type type;
\r
60 template<typename FArgs>
\r
61 struct is_function_with_no_args : mpl::false_ {};
\r
63 template<typename F>
\r
64 struct is_function_with_no_args<F(void)> : mpl::true_ {};
\r
66 template<typename F, typename FArgs>
\r
67 struct result_of_nested_result : F::template result<FArgs>
\r
70 template<typename F, typename FArgs>
\r
71 struct result_of_impl<F, FArgs, false>
\r
72 : mpl::if_<is_function_with_no_args<FArgs>,
\r
73 result_of_void_impl<F>,
\r
74 result_of_nested_result<F, FArgs> >::type
\r
77 } // end namespace detail
\r
79 #define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>))
\r
80 #include BOOST_PP_ITERATE()
\r
83 # define BOOST_NO_RESULT_OF 1
\r
88 #endif // BOOST_RESULT_OF_HPP
\r