source: NonGTP/Boost/boost/spirit/fusion/iterator/detail/tuple_iterator/prior_traits.hpp @ 857

Revision 857, 2.1 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 2003 Joel de Guzman
3    Copyright (c) 2004 Peder Holt
4
5    Use, modification and distribution is subject to the Boost Software
6    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7    http://www.boost.org/LICENSE_1_0.txt)
8==============================================================================*/
9#if !defined(FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_PRIOR_TRAITS_HPP)
10#define FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_PRIOR_TRAITS_HPP
11
12#include <boost/spirit/fusion/detail/config.hpp>
13#include <boost/static_assert.hpp>
14#include <boost/mpl/prior.hpp>
15#include <boost/mpl/greater_equal.hpp>
16#include <boost/mpl/int.hpp>
17
18namespace boost { namespace fusion
19{
20    struct tuple_iterator_tag;
21
22    template <int N, typename Tuple>
23    struct tuple_iterator;
24
25    namespace detail
26    {
27        template <typename Iterator>
28        struct tuple_iterator_prior_traits_impl
29        {
30            typedef FUSION_GET_INDEX(Iterator) index;
31            typedef FUSION_GET_TUPLE(Iterator) tuple_;
32            typedef FUSION_INT(0) other_index;
33#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300)
34            BOOST_STATIC_ASSERT((
35                ::boost::mpl::greater_equal<index, other_index >::value));
36#endif
37            typedef typename mpl::prior<index>::type prior;
38            typedef tuple_iterator<FUSION_GET_VALUE(prior), tuple_> type;
39
40            static type
41            call(Iterator const& i);
42        };
43
44        template <typename Iterator>
45        inline typename tuple_iterator_prior_traits_impl<Iterator>::type
46        tuple_iterator_prior_traits_impl<Iterator>::call(Iterator const& i)
47        {
48            return type(detail::ref(i.get_tuple()));
49        }
50    }
51
52    namespace meta
53    {
54        template <typename Tag>
55        struct prior_impl;
56
57        template <>
58        struct prior_impl<tuple_iterator_tag>
59        {
60            template <typename Iterator>
61            struct apply : detail::tuple_iterator_prior_traits_impl<Iterator> {};
62        };
63    }
64}}
65
66#endif
67
Note: See TracBrowser for help on using the repository browser.