| 1 | // Copyright David Abrahams 2005. |
|---|---|
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // (See accompanying file LICENSE_1_0.txt or copy at |
| 4 | // http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #ifndef BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP |
| 7 | #define BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP |
| 8 | |
| 9 | #include <boost/parameter/aux_/use_default_tag.hpp> |
| 10 | #include <boost/parameter/config.hpp> |
| 11 | #include <boost/utility/result_of.hpp> |
| 12 | |
| 13 | #if defined(BOOST_PARAMETER_CAN_USE_MP11) |
| 14 | #include <boost/mp11/utility.hpp> |
| 15 | #include <type_traits> |
| 16 | #else |
| 17 | #include <boost/mpl/if.hpp> |
| 18 | #include <boost/type_traits/is_void.hpp> |
| 19 | #endif |
| 20 | |
| 21 | namespace boost { namespace parameter { namespace aux { |
| 22 | |
| 23 | // A metafunction returning the result of invoking |
| 24 | // a nullary function object of the given type. |
| 25 | template <typename F> |
| 26 | class result_of0 |
| 27 | { |
| 28 | #if defined(BOOST_NO_RESULT_OF) |
| 29 | typedef typename F::result_type result_of_F; |
| 30 | #else |
| 31 | typedef typename ::boost::result_of<F()>::type result_of_F; |
| 32 | #endif |
| 33 | |
| 34 | public: |
| 35 | #if defined(BOOST_PARAMETER_CAN_USE_MP11) |
| 36 | using type = ::boost::mp11::mp_if< |
| 37 | ::std::is_void<result_of_F> |
| 38 | #else |
| 39 | typedef typename ::boost::mpl::if_< |
| 40 | ::boost::is_void<result_of_F> |
| 41 | #endif |
| 42 | , ::boost::parameter::aux::use_default_tag |
| 43 | , result_of_F |
| 44 | #if defined(BOOST_PARAMETER_CAN_USE_MP11) |
| 45 | >; |
| 46 | #else |
| 47 | >::type type; |
| 48 | #endif |
| 49 | }; |
| 50 | }}} // namespace boost::parameter::aux |
| 51 | |
| 52 | #endif // include guard |
| 53 | |
| 54 |
