~tsarev/boostdc/cmake

« back to all changes in this revision

Viewing changes to boost/boost/fusion/support/category_of.hpp

  • Committer: bigmuscle
  • Date: 2010-05-08 08:47:15 UTC
  • Revision ID: svn-v4:5fb55d53-692c-0410-a46a-e90ab66e00ee:trunk:497
removed old boost version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=============================================================================
2
 
    Copyright (c) 2001-2006 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_CATEGORY_OF_07202005_0308)
8
 
#define FUSION_CATEGORY_OF_07202005_0308
9
 
 
10
 
#include <boost/fusion/support/detail/category_of.hpp>
11
 
#include <boost/fusion/support/tag_of.hpp>
12
 
#include <boost/type_traits/is_base_of.hpp>
13
 
 
14
 
namespace boost { namespace fusion
15
 
{
16
 
    // Special tags:
17
 
    struct boost_tuple_tag; // boost::tuples::tuple tag
18
 
    struct array_tag; // boost::array tag
19
 
    struct mpl_sequence_tag; // mpl sequence tag
20
 
    struct std_pair_tag; // std::pair tag
21
 
 
22
 
    struct incrementable_traversal_tag {};
23
 
 
24
 
    struct single_pass_traversal_tag
25
 
        : incrementable_traversal_tag {};
26
 
 
27
 
    struct forward_traversal_tag
28
 
        : single_pass_traversal_tag {};
29
 
 
30
 
    struct bidirectional_traversal_tag
31
 
        : forward_traversal_tag {};
32
 
 
33
 
    struct random_access_traversal_tag
34
 
        : bidirectional_traversal_tag {};
35
 
 
36
 
    struct associative_sequence_tag {};
37
 
 
38
 
    namespace extension
39
 
    {
40
 
        template<typename Tag>
41
 
        struct category_of_impl
42
 
        {
43
 
            template<typename T>
44
 
            struct apply : detail::fusion_category_of<T> {};
45
 
        };
46
 
 
47
 
        template <>
48
 
        struct category_of_impl<boost_tuple_tag>;
49
 
 
50
 
        template <>
51
 
        struct category_of_impl<array_tag>;
52
 
 
53
 
        template <>
54
 
        struct category_of_impl<mpl_sequence_tag>;
55
 
 
56
 
        template <>
57
 
        struct category_of_impl<std_pair_tag>;
58
 
    }
59
 
 
60
 
    namespace traits
61
 
    {
62
 
        template <typename T>
63
 
        struct category_of
64
 
            : extension::category_of_impl<typename fusion::detail::tag_of<T>::type>::
65
 
                template apply<T>
66
 
        {};
67
 
 
68
 
        template <typename T>
69
 
        struct is_associative
70
 
            : is_base_of<
71
 
                associative_sequence_tag
72
 
              , typename category_of<T>::type>
73
 
        {};
74
 
 
75
 
        template <typename T>
76
 
        struct is_incrementable
77
 
            : is_base_of<
78
 
                incrementable_traversal_tag
79
 
              , typename category_of<T>::type>
80
 
        {};
81
 
 
82
 
        template <typename T>
83
 
        struct is_single_pass
84
 
            : is_base_of<
85
 
                single_pass_traversal_tag
86
 
              , typename category_of<T>::type>
87
 
        {};
88
 
 
89
 
        template <typename T>
90
 
        struct is_forward
91
 
            : is_base_of<
92
 
                forward_traversal_tag
93
 
              , typename category_of<T>::type>
94
 
        {};
95
 
 
96
 
        template <typename T>
97
 
        struct is_bidirectional
98
 
            : is_base_of<
99
 
                bidirectional_traversal_tag
100
 
              , typename category_of<T>::type>
101
 
        {};
102
 
 
103
 
        template <typename T>
104
 
        struct is_random_access
105
 
            : is_base_of<
106
 
                random_access_traversal_tag
107
 
              , typename category_of<T>::type>
108
 
        {};
109
 
    }
110
 
}}
111
 
 
112
 
#endif