source: NonGTP/Boost/boost/spirit/fusion/iterator/detail/tuple_iterator/deref_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
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_ITERATOR_DETAIL_TUPLE_ITERATOR_DEREF_TRAITS_HPP)
9#define FUSION_ITERATOR_DETAIL_TUPLE_ITERATOR_DEREF_TRAITS_HPP
10
11#include <boost/spirit/fusion/detail/config.hpp>
12#include <boost/spirit/fusion/detail/access.hpp>
13#include <boost/spirit/fusion/sequence/detail/tuple_access_result.hpp>
14
15namespace boost { namespace fusion
16{
17    struct tuple_iterator_tag;
18
19    namespace detail
20    {
21        template <int N>
22        struct tuple_access;
23    }
24
25    namespace tuple_iterator_detail
26    {
27        template <typename Iterator>
28        struct deref_traits_impl
29        {
30            typedef FUSION_GET_INDEX(Iterator) index;
31            typedef FUSION_GET_TUPLE(Iterator) tuple_;
32
33            typedef BOOST_DEDUCED_TYPENAME
34                boost::fusion::detail::tuple_access_result<
35                    tuple_, FUSION_GET_VALUE(index)>::type
36            type;
37
38            static type
39            call(Iterator const& i);
40        };
41
42        template <typename Iterator>
43        inline typename deref_traits_impl<Iterator>::type
44        deref_traits_impl<Iterator>::call(Iterator const& i)
45        {
46            return detail::tuple_access<FUSION_GET_VALUE(index)>
47                ::get(detail::ref(i.get_tuple()));
48        }
49    }
50
51    namespace meta
52    {
53        template <typename Tag>
54        struct deref_impl;
55
56        template <>
57        struct deref_impl<tuple_iterator_tag>
58        {
59            template <typename Iterator>
60            struct apply :
61                tuple_iterator_detail::deref_traits_impl<Iterator> {};
62        };
63    }
64}}
65
66#endif
Note: See TracBrowser for help on using the repository browser.