source: NonGTP/Boost/boost/spirit/fusion/sequence/detail/tuple10.hpp @ 857

Revision 857, 4.0 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 2001-2003 Joel de Guzman
3
4    Use, modification and distribution is subject to the Boost Software
5    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6    http://www.boost.org/LICENSE_1_0.txt)
7==============================================================================*/
8#if !defined(FUSION_SEQUENCE_DETAIL_TUPLE10_HPP)
9#define FUSION_SEQUENCE_DETAIL_TUPLE10_HPP
10
11#include <boost/spirit/fusion/detail/config.hpp>
12#include <boost/spirit/fusion/detail/access.hpp>
13#include <boost/spirit/fusion/iterator/tuple_iterator.hpp>
14#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp>
15#include <boost/spirit/fusion/sequence/detail/tuple_value_at_traits.hpp>
16#include <boost/spirit/fusion/sequence/detail/tuple_at_traits.hpp>
17#include <boost/spirit/fusion/sequence/detail/tuple_size_traits.hpp>
18#include <boost/spirit/fusion/sequence/detail/tuple_begin_end_traits.hpp>
19#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp>
20#include <boost/spirit/fusion/iterator/next.hpp>
21#include <boost/mpl/bool.hpp>
22#include <boost/mpl/at.hpp>
23#include <boost/mpl/int.hpp>
24#include <boost/mpl/eval_if.hpp>
25#include <boost/mpl/vector/vector10.hpp>
26#include <boost/type_traits/is_convertible.hpp>
27#include <boost/type_traits/is_base_and_derived.hpp>
28#include <boost/preprocessor/iteration/iterate.hpp>
29
30#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
31# include <boost/spirit/fusion/iterator/next.hpp>
32#endif
33
34namespace boost { namespace fusion
35{
36    namespace detail
37    {
38        struct disambiguate_as_tuple {};
39        struct disambiguate_as_data {};
40        struct disambiguate_as_iterator {};
41
42        template <typename X, typename T0>
43        struct disambiguate
44        {
45            typedef typename
46                mpl::if_<
47                    is_convertible<X, T0>
48                  , disambiguate_as_data
49                  , typename mpl::if_<
50                        is_base_and_derived<sequence_root, X>
51                      , disambiguate_as_tuple
52                      , disambiguate_as_iterator
53                    >::type
54                >::type
55            type;
56
57            static type
58            call()
59            {
60                FUSION_RETURN_DEFAULT_CONSTRUCTED;
61            }
62        };
63
64        template <int N>
65        struct tuple_access;
66
67        template <>
68        struct tuple_access<0>
69        {
70            template <typename Tuple>
71            static typename tuple_access_result<Tuple, 0>::type
72            get(Tuple& t)
73            {
74                FUSION_RETURN_TUPLE_MEMBER(0);
75            }
76        };
77
78        template <>
79        struct tuple_access<1>
80        {
81            template <typename Tuple>
82            static typename tuple_access_result<Tuple, 1>::type
83            get(Tuple& t)
84            {
85                FUSION_RETURN_TUPLE_MEMBER(1);
86            }
87        };
88
89        template <>
90        struct tuple_access<2>
91        {
92            template <typename Tuple>
93            static typename tuple_access_result<Tuple, 2>::type
94            get(Tuple& t)
95            {
96                FUSION_RETURN_TUPLE_MEMBER(2);
97            }
98        };
99
100}}} // namespace boost::fusion::detail
101
102///////////////////////////////////////////////////////////////////////////////
103//
104//  Bring in the rest of the fixed-tuples using the pre-processor. Generate
105//  expansions for the tuple_access<N> and tupleN+1 classes for N = 3..10.
106//
107///////////////////////////////////////////////////////////////////////////////
108#include <boost/spirit/fusion/sequence/detail/tuple_macro.hpp>
109
110namespace boost { namespace fusion
111{
112    namespace detail
113    {
114        BOOST_PP_REPEAT_FROM_TO(3, 10, FUSION_TUPLE_N_ACCESS, _)
115    }
116
117    struct tuple_tag;
118
119#  define BOOST_PP_ITERATION_PARAMS_1 (3, (4, 10, <boost/spirit/fusion/sequence/detail/tuple_body.hpp>))
120#  include BOOST_PP_ITERATE()
121}}
122
123#endif
Note: See TracBrowser for help on using the repository browser.