to_sequence.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_DETAIL_TO_SEQUENCE_HPP_INCLUDED
  7. #define BOOST_FT_DETAIL_TO_SEQUENCE_HPP_INCLUDED
  8. #include <boost/mpl/eval_if.hpp>
  9. #include <boost/mpl/identity.hpp>
  10. #include <boost/mpl/is_sequence.hpp>
  11. #include <boost/mpl/placeholders.hpp>
  12. #include <boost/type_traits/add_reference.hpp>
  13. #include <boost/function_types/is_callable_builtin.hpp>
  14. namespace boost { namespace function_types { namespace detail {
  15. // wrap first arguments in components, if callable builtin type
  16. template<typename T>
  17. struct to_sequence
  18. {
  19. typedef typename
  20. mpl::eval_if
  21. < is_callable_builtin<T>
  22. , to_sequence< components<T> >
  23. , mpl::identity< T >
  24. >::type
  25. type;
  26. };
  27. // reduce template instantiations, if possible
  28. template<typename T, typename U>
  29. struct to_sequence< components<T,U> >
  30. {
  31. typedef typename components<T,U>::types type;
  32. };
  33. } } } // namespace ::boost::function_types::detail
  34. #endif