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

Revision 857, 2.5 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_SEQUENCE_DETAIL_FILTER_VIEW_BEGIN_END_TRAITS_HPP)
9#define FUSION_SEQUENCE_DETAIL_FILTER_VIEW_BEGIN_END_TRAITS_HPP
10
11#include <boost/spirit/fusion/detail/config.hpp>
12
13namespace boost { namespace fusion
14{
15    struct filter_view_tag;
16
17    template <typename View, typename Pred>
18    struct filter_view;
19
20    template <typename First, typename Last, typename Pred>
21    struct filter_iterator;
22
23    namespace meta
24    {
25        template <typename Tag>
26        struct begin_impl;
27
28        template <>
29        struct begin_impl<filter_view_tag>
30        {
31            template <typename Sequence>
32            struct apply
33            {
34                typedef typename Sequence::first_type first_type;
35                typedef typename Sequence::last_type last_type;
36                typedef typename Sequence::pred_type pred_type;
37                typedef filter_iterator<first_type, last_type, pred_type> type;
38
39                static type
40                call(Sequence& s)
41                {
42                    return type(s.first);
43                }
44            };
45        };
46
47        template <typename Tag>
48        struct end_impl;
49
50        template <>
51        struct end_impl<filter_view_tag>
52        {
53            template <typename Sequence>
54            struct apply
55            {
56                typedef typename Sequence::last_type last_type;
57                typedef typename Sequence::pred_type pred_type;
58                typedef filter_iterator<last_type, last_type, pred_type> type;
59
60                static type
61                call(Sequence& s)
62                {
63                    return type(s.last);
64                }
65            };
66        };
67    }
68}}
69
70namespace boost { namespace mpl
71{
72    template <typename Tag>
73    struct begin_impl;
74
75    template <typename Tag>
76    struct end_impl;
77
78    template <>
79    struct begin_impl<fusion::filter_view_tag>
80        : fusion::meta::begin_impl<fusion::filter_view_tag> {};
81
82    template <>
83    struct end_impl<fusion::filter_view_tag>
84        : fusion::meta::end_impl<fusion::filter_view_tag> {};
85}}
86
87#endif
88
89
Note: See TracBrowser for help on using the repository browser.