category_of_impl.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 Joel de Guzman
  3. Copyright (c) 2005-2006 Dan Marsden
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #if !defined(BOOST_FUSION_CATEGORY_OF_IMPL_20060217_2141)
  8. #define BOOST_FUSION_CATEGORY_OF_IMPL_20060217_2141
  9. #include <boost/fusion/support/config.hpp>
  10. #include <boost/fusion/support/detail/mpl_iterator_category.hpp>
  11. #include <boost/mpl/begin_end.hpp>
  12. #include <boost/mpl/is_sequence.hpp>
  13. #include <boost/static_assert.hpp>
  14. namespace boost { namespace fusion {
  15. namespace detail
  16. {
  17. template <typename T>
  18. struct mpl_sequence_category_of
  19. {
  20. // assumes T is an mpl sequence
  21. // there should be no way this will ever be
  22. // called where T is an mpl iterator
  23. BOOST_STATIC_ASSERT(mpl::is_sequence<T>::value);
  24. typedef typename
  25. mpl_iterator_category<
  26. typename mpl::begin<T>::type::category
  27. >::type
  28. type;
  29. };
  30. }
  31. struct mpl_sequence_tag;
  32. namespace extension
  33. {
  34. template<typename Tag>
  35. struct category_of_impl;
  36. template<>
  37. struct category_of_impl<mpl_sequence_tag>
  38. {
  39. template<typename T>
  40. struct apply
  41. : detail::mpl_sequence_category_of<T>
  42. {};
  43. };
  44. }
  45. }}
  46. #endif