source: NonGTP/Boost/boost/spirit/fusion/sequence/detail/range_begin_end_traits.hpp @ 857

Revision 857, 2.6 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_SEQUENCE_DETAIL_RANGE_BEGIN_END_TRAITS_HPP)
10#define FUSION_SEQUENCE_DETAIL_RANGE_BEGIN_END_TRAITS_HPP
11
12#include <boost/spirit/fusion/detail/config.hpp>
13
14namespace boost { namespace fusion
15{
16    struct range_tag;
17
18    template <typename First, typename Last>
19    struct range;
20
21    template <typename Tag>
22    struct begin_impl;
23
24    namespace range_detail
25    {
26        template <typename Sequence>
27        struct begin_traits_impl
28        {
29            typedef typename Sequence::begin_type type;
30
31            static type
32            call(Sequence const& s);
33        };
34
35        template <typename Sequence>
36        inline typename begin_traits_impl<Sequence>::type
37        begin_traits_impl<Sequence>::call(Sequence const& s)
38        {
39            return s.first;
40        }
41
42        template <typename Sequence>
43        struct end_traits_impl
44        {
45            typedef typename Sequence::end_type type;
46
47            static type
48            call(Sequence const& s);
49        };
50
51        template <typename Sequence>
52        inline typename end_traits_impl<Sequence>::type
53        end_traits_impl<Sequence>::call(Sequence const& s)
54        {
55            return s.last;
56        }
57    }
58
59    namespace meta
60    {
61        template <typename Tag>
62        struct begin_impl;
63
64        template <>
65        struct begin_impl<range_tag>
66        {
67            template <typename Sequence>
68            struct apply : range_detail::begin_traits_impl<Sequence>
69            {};
70        };
71
72        template <typename Tag>
73        struct end_impl;
74
75        template <>
76        struct end_impl<range_tag>
77        {
78            template <typename Sequence>
79            struct apply : range_detail::end_traits_impl<Sequence>
80            {};
81        };
82    }
83}}
84
85namespace boost { namespace mpl
86{
87    template <typename Tag>
88    struct begin_impl;
89
90    template <typename Tag>
91    struct end_impl;
92
93    template <>
94    struct begin_impl<fusion::range_tag>
95        : fusion::meta::begin_impl<fusion::range_tag> {};
96
97    template <>
98    struct end_impl<fusion::range_tag>
99        : fusion::meta::end_impl<fusion::range_tag> {};
100}}
101
102#endif
103
104
Note: See TracBrowser for help on using the repository browser.