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