source: NonGTP/Boost/boost/spirit/fusion/iterator/detail/single_view_iterator/deref_traits.hpp @ 857

Revision 857, 2.2 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_SINGLE_VIEW_ITERATOR_DEREF_TRAITS_HPP)
9#define FUSION_ITERATOR_DETAIL_SINGLE_VIEW_ITERATOR_DEREF_TRAITS_HPP
10
11#include <boost/spirit/fusion/detail/config.hpp>
12#include <boost/spirit/fusion/detail/access.hpp>
13#include <boost/mpl/identity.hpp>
14
15namespace boost { namespace fusion
16{
17    namespace detail
18    {
19        template <typename SingleView>
20        struct single_view_access_result
21        {
22            typedef typename
23                mpl::eval_if<
24                    is_const<SingleView>
25                  , cref_result<mpl::identity<FUSION_GET_VALUE_TYPE(SingleView)> >
26                  , ref_result<mpl::identity<FUSION_GET_VALUE_TYPE(SingleView)> >
27                >::type
28            type;
29        };
30    }
31
32    namespace single_view_iterator_detail
33    {
34        template <typename Iterator>
35        struct deref_traits_impl
36        {
37            typedef typename Iterator::single_view_type single_view_type;
38            typedef typename detail::single_view_access_result<
39                single_view_type>::type
40            type;
41
42            static type
43            call(Iterator const& i);
44        };
45
46        template <typename Iterator>
47        inline typename deref_traits_impl<Iterator>::type
48        deref_traits_impl<Iterator>::call(Iterator const& i)
49        {
50            return detail::ref(i.view.val);
51        }
52    }
53
54    struct single_view_iterator_tag;
55
56    namespace meta
57    {
58        template <typename Tag>
59        struct deref_impl;
60
61        template <>
62        struct deref_impl<single_view_iterator_tag>
63        {
64            template <typename Iterator>
65            struct apply : single_view_iterator_detail::deref_traits_impl<Iterator> {};
66        };
67    }
68}}
69
70#endif
71
72
Note: See TracBrowser for help on using the repository browser.