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

Revision 857, 1.8 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*=============================================================================
2    Copyright (c) 2003 Joel de Guzman
3    Copyright (c) 2005 Eric Niebler
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_CONS_ITERATOR_DEREF_TRAITS_HPP)
10#define FUSION_ITERATOR_DETAIL_CONS_ITERATOR_DEREF_TRAITS_HPP
11
12#include <boost/spirit/fusion/detail/config.hpp>
13#include <boost/mpl/eval_if.hpp>
14#include <boost/type_traits/is_const.hpp>
15#include <boost/type_traits/add_const.hpp>
16#include <boost/type_traits/add_reference.hpp>
17
18namespace boost { namespace fusion
19{
20    struct cons_iterator_tag;
21
22    namespace cons_detail
23    {
24        template <typename Iterator>
25        struct deref_traits_impl
26        {
27            typedef typename Iterator::cons_type cons_type;
28            typedef typename cons_type::car_type value_type;
29
30            typedef typename mpl::eval_if<
31                is_const<cons_type>
32              , add_reference<typename add_const<value_type>::type>
33              , add_reference<value_type> >::type
34            type;
35
36            static type
37            call(Iterator const& i)
38            {
39                return detail::ref(i.cons.car);
40            }
41        };
42    }
43
44    namespace meta
45    {
46        template <typename Tag>
47        struct deref_impl;
48
49        template <>
50        struct deref_impl<cons_iterator_tag>
51        {
52            template <typename Iterator>
53            struct apply : cons_detail::deref_traits_impl<Iterator> {};
54        };
55    }
56}}
57
58#endif
59
60
Note: See TracBrowser for help on using the repository browser.