1 | /*============================================================================= |
2 | Copyright (c) 2001-2011 Joel de Guzman |
3 | |
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(FUSION_TAG_OF_09232005_0845) |
8 | #define FUSION_TAG_OF_09232005_0845 |
9 | |
10 | #include <boost/fusion/support/config.hpp> |
11 | #include <boost/utility/enable_if.hpp> |
12 | #include <boost/type_traits/remove_const.hpp> |
13 | #include <boost/fusion/support/tag_of_fwd.hpp> |
14 | #include <boost/fusion/support/detail/is_mpl_sequence.hpp> |
15 | #include <boost/mpl/has_xxx.hpp> |
16 | #include <boost/mpl/identity.hpp> |
17 | #include <boost/mpl/assert.hpp> |
18 | #include <boost/mpl/bool.hpp> |
19 | #include <boost/mpl/if.hpp> |
20 | #include <boost/config/no_tr1/utility.hpp> |
21 | |
22 | namespace boost |
23 | { |
24 | template <typename T, std::size_t N> |
25 | class array; // forward |
26 | |
27 | namespace tuples |
28 | { |
29 | struct null_type; |
30 | |
31 | template < |
32 | class T0, class T1, class T2, class T3, class T4, |
33 | class T5, class T6, class T7, class T8, class T9 |
34 | > |
35 | class tuple; |
36 | |
37 | template <class Head, class Tail> |
38 | struct cons; |
39 | } |
40 | } |
41 | |
42 | namespace boost { namespace fusion |
43 | { |
44 | struct non_fusion_tag; |
45 | struct mpl_sequence_tag; |
46 | |
47 | namespace detail |
48 | { |
49 | BOOST_MPL_HAS_XXX_TRAIT_DEF(fusion_tag) |
50 | |
51 | template <typename Sequence, typename Active> |
52 | struct tag_of_impl |
53 | : mpl::if_<fusion::detail::is_mpl_sequence<Sequence>, |
54 | mpl::identity<mpl_sequence_tag>, |
55 | mpl::identity<non_fusion_tag> >::type |
56 | {}; |
57 | |
58 | template <typename Sequence> |
59 | struct tag_of_impl< |
60 | Sequence |
61 | , typename boost::enable_if<detail::has_fusion_tag<Sequence> >::type> |
62 | { |
63 | typedef typename Sequence::fusion_tag type; |
64 | }; |
65 | } |
66 | |
67 | namespace traits |
68 | { |
69 | template <typename Sequence, typename Active> |
70 | struct tag_of |
71 | : boost::fusion::detail::tag_of_impl<Sequence, Active> |
72 | {}; |
73 | } |
74 | |
75 | namespace detail |
76 | { |
77 | template<typename T> |
78 | struct tag_of |
79 | : traits::tag_of<typename remove_const<T>::type> |
80 | {}; |
81 | } |
82 | }} |
83 | #endif |
84 | |