result_of0.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
  6. #define BOOST_PARAMETER_AUX_RESULT_OF0_DWA2005511_HPP
  7. #include <boost/parameter/aux_/use_default_tag.hpp>
  8. #include <boost/parameter/config.hpp>
  9. #include <boost/utility/result_of.hpp>
  10. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  11. #include <boost/mp11/utility.hpp>
  12. #include <type_traits>
  13. #else
  14. #include <boost/mpl/if.hpp>
  15. #include <boost/type_traits/is_void.hpp>
  16. #endif
  17. namespace boost { namespace parameter { namespace aux {
  18. // A metafunction returning the result of invoking
  19. // a nullary function object of the given type.
  20. template <typename F>
  21. class result_of0
  22. {
  23. #if defined(BOOST_NO_RESULT_OF)
  24. typedef typename F::result_type result_of_F;
  25. #else
  26. typedef typename ::boost::result_of<F()>::type result_of_F;
  27. #endif
  28. public:
  29. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  30. using type = ::boost::mp11::mp_if<
  31. ::std::is_void<result_of_F>
  32. #else
  33. typedef typename ::boost::mpl::if_<
  34. ::boost::is_void<result_of_F>
  35. #endif
  36. , ::boost::parameter::aux::use_default_tag
  37. , result_of_F
  38. #if defined(BOOST_PARAMETER_CAN_USE_MP11)
  39. >;
  40. #else
  41. >::type type;
  42. #endif
  43. };
  44. }}} // namespace boost::parameter::aux
  45. #endif // include guard