result_type.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // (C) Copyright Tobias Schwinger
  2. //
  3. // Use modification and distribution are subject to the boost Software License,
  4. // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
  5. //------------------------------------------------------------------------------
  6. #ifndef BOOST_FT_RESULT_TYPE_HPP_INCLUDED
  7. #define BOOST_FT_RESULT_TYPE_HPP_INCLUDED
  8. #include <boost/blank.hpp>
  9. #include <boost/mpl/if.hpp>
  10. #include <boost/mpl/aux_/lambda_support.hpp>
  11. #include <boost/mpl/at.hpp>
  12. #include <boost/function_types/is_callable_builtin.hpp>
  13. #include <boost/function_types/components.hpp>
  14. namespace boost
  15. {
  16. namespace function_types
  17. {
  18. template< typename T > struct result_type;
  19. namespace detail
  20. {
  21. template<typename T> struct result_type_impl
  22. : mpl::at_c
  23. < typename function_types::components<T>::types, 0 >
  24. { };
  25. }
  26. template<typename T> struct result_type
  27. : mpl::if_
  28. < function_types::is_callable_builtin<T>
  29. , detail::result_type_impl<T>, boost::blank
  30. >::type
  31. {
  32. BOOST_MPL_AUX_LAMBDA_SUPPORT(1,result_type,(T))
  33. };
  34. }
  35. }
  36. #endif