[857] | 1 | // Boost result_of library
|
---|
| 2 |
|
---|
| 3 | // Copyright Douglas Gregor 2004. Use, modification and
|
---|
| 4 | // distribution is subject to the Boost Software License, Version
|
---|
| 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 6 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 7 |
|
---|
| 8 | // For more information, see http://www.boost.org/libs/utility
|
---|
| 9 | #ifndef BOOST_RESULT_OF_HPP
|
---|
| 10 | #define BOOST_RESULT_OF_HPP
|
---|
| 11 |
|
---|
| 12 | #include <boost/config.hpp>
|
---|
| 13 | #include <boost/type_traits/ice.hpp>
|
---|
| 14 | #include <boost/type.hpp>
|
---|
| 15 | #include <boost/preprocessor.hpp>
|
---|
| 16 | #include <boost/detail/workaround.hpp>
|
---|
| 17 | #include <boost/mpl/has_xxx.hpp>
|
---|
| 18 |
|
---|
| 19 | #ifndef BOOST_RESULT_OF_NUM_ARGS
|
---|
| 20 | # define BOOST_RESULT_OF_NUM_ARGS 10
|
---|
| 21 | #endif
|
---|
| 22 |
|
---|
| 23 | namespace boost {
|
---|
| 24 |
|
---|
| 25 | template<typename F> struct result_of;
|
---|
| 26 |
|
---|
| 27 | #if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
---|
| 28 | namespace detail {
|
---|
| 29 |
|
---|
| 30 | BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
|
---|
| 31 |
|
---|
| 32 | template<typename F, typename FArgs, bool HasResultType> struct get_result_of;
|
---|
| 33 |
|
---|
| 34 | template<typename F, typename FArgs>
|
---|
| 35 | struct get_result_of<F, FArgs, true>
|
---|
| 36 | {
|
---|
| 37 | typedef typename F::result_type type;
|
---|
| 38 | };
|
---|
| 39 |
|
---|
| 40 | template<typename F, typename FArgs>
|
---|
| 41 | struct get_result_of<F, FArgs, false>
|
---|
| 42 | {
|
---|
| 43 | typedef typename F::template result<FArgs>::type type;
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | template<typename F>
|
---|
| 47 | struct get_result_of<F, F(void), false>
|
---|
| 48 | {
|
---|
| 49 | typedef void type;
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | template<typename F, typename FArgs>
|
---|
| 53 | struct result_of : get_result_of<F, FArgs, (has_result_type<F>::value)> {};
|
---|
| 54 |
|
---|
| 55 | } // end namespace detail
|
---|
| 56 |
|
---|
| 57 | #define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>))
|
---|
| 58 | #include BOOST_PP_ITERATE()
|
---|
| 59 |
|
---|
| 60 | #else
|
---|
| 61 | # define BOOST_NO_RESULT_OF 1
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | #endif // BOOST_RESULT_OF_HPP
|
---|