]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fusion/include/boost/fusion/view/filter_view/filter_view.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / fusion / include / boost / fusion / view / filter_view / filter_view.hpp
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #if !defined(FUSION_SEQUENCE_FILTER_VIEW_HPP)
8 #define FUSION_SEQUENCE_FILTER_VIEW_HPP
9
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/support/detail/access.hpp>
12 #include <boost/fusion/support/sequence_base.hpp>
13 #include <boost/fusion/support/is_view.hpp>
14 #include <boost/fusion/view/filter_view/filter_view_iterator.hpp>
15 #include <boost/fusion/view/filter_view/detail/begin_impl.hpp>
16 #include <boost/fusion/view/filter_view/detail/end_impl.hpp>
17 #include <boost/fusion/view/filter_view/detail/size_impl.hpp>
18 #include <boost/fusion/sequence/intrinsic/begin.hpp>
19 #include <boost/fusion/sequence/intrinsic/end.hpp>
20 #include <boost/mpl/bool.hpp>
21 #include <boost/mpl/eval_if.hpp>
22 #include <boost/mpl/inherit.hpp>
23 #include <boost/mpl/identity.hpp>
24
25 namespace boost { namespace fusion
26 {
27 struct filter_view_tag;
28 struct forward_traversal_tag;
29 struct fusion_sequence_tag;
30
31 template <typename Sequence, typename Pred>
32 struct filter_view : sequence_base<filter_view<Sequence, Pred> >
33 {
34 typedef filter_view_tag fusion_tag;
35 typedef fusion_sequence_tag tag; // this gets picked up by MPL
36 typedef typename
37 mpl::eval_if<
38 traits::is_associative<Sequence>
39 , mpl::inherit2<forward_traversal_tag,associative_tag>
40 , mpl::identity<forward_traversal_tag>
41 >::type
42 category;
43 typedef mpl::true_ is_view;
44
45 typedef typename result_of::begin<Sequence>::type first_type;
46 typedef typename result_of::end<Sequence>::type last_type;
47 typedef Pred pred_type;
48
49 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
50 filter_view(Sequence& in_seq)
51 : seq(in_seq)
52 {}
53
54 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
55 first_type first() const { return fusion::begin(seq); }
56 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
57 last_type last() const { return fusion::end(seq); }
58 typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq;
59
60 private:
61 // silence MSVC warning C4512: assignment operator could not be generated
62 filter_view& operator= (filter_view const&);
63 };
64 }}
65
66 #endif
67
68