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

Revision 857, 2.0 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_NEXT_TRAITS_HPP)
10#define FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_NEXT_TRAITS_HPP
11
12#include <boost/spirit/fusion/detail/config.hpp>
13#include <boost/static_assert.hpp>
14#include <boost/mpl/next.hpp>
15#include <boost/mpl/less.hpp>
16
17namespace boost { namespace fusion
18{
19    struct tuple_iterator_tag;
20
21    template <int N, typename Tuple>
22    struct tuple_iterator;
23
24    namespace detail
25    {
26        template <typename Iterator>
27        struct tuple_iterator_next_traits_impl
28        {
29            typedef FUSION_GET_INDEX(Iterator) index;
30            typedef FUSION_GET_TUPLE(Iterator) tuple_;
31            typedef FUSION_GET_SIZE(tuple_) size;
32#if !BOOST_WORKAROUND(BOOST_MSVC,<=1300)
33            BOOST_STATIC_ASSERT((::boost::mpl::less<index, size>::value));
34#endif
35            typedef typename mpl::next<index>::type next;
36            typedef tuple_iterator<FUSION_GET_VALUE(next), tuple_> type;
37
38            static type
39            call(Iterator const& i);
40        };
41
42        template <typename Iterator>
43        inline typename tuple_iterator_next_traits_impl<Iterator>::type
44        tuple_iterator_next_traits_impl<Iterator>::call(Iterator const& i)
45        {
46            return type(detail::ref(i.get_tuple()));
47        }
48    }
49
50    namespace meta
51    {
52        template <typename Tag>
53        struct next_impl;
54
55        template <>
56        struct next_impl<tuple_iterator_tag>
57        {
58            template <typename Iterator>
59            struct apply : detail::tuple_iterator_next_traits_impl<Iterator> {};
60        };
61    }
62}}
63
64#endif
65
Note: See TracBrowser for help on using the repository browser.