]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/fusion/view/filter_view/filter_view_iterator.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / fusion / view / filter_view / filter_view_iterator.hpp
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3 Copyright (c) 2018 Kohei Takahashi
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(FUSION_FILTER_VIEW_ITERATOR_05062005_0849)
9 #define FUSION_FILTER_VIEW_ITERATOR_05062005_0849
10
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/iterator/mpl/convert_iterator.hpp>
13 #include <boost/fusion/iterator/value_of.hpp>
14 #include <boost/fusion/support/iterator_base.hpp>
15 #include <boost/fusion/algorithm/query/detail/find_if.hpp>
16 #include <boost/mpl/lambda.hpp>
17 #include <boost/mpl/quote.hpp>
18 #include <boost/mpl/bind.hpp>
19 #include <boost/mpl/placeholders.hpp>
20
21 #include <boost/fusion/view/filter_view/detail/deref_impl.hpp>
22 #include <boost/fusion/view/filter_view/detail/next_impl.hpp>
23 #include <boost/fusion/view/filter_view/detail/value_of_impl.hpp>
24 #include <boost/fusion/view/filter_view/detail/equal_to_impl.hpp>
25 #include <boost/fusion/view/filter_view/detail/deref_data_impl.hpp>
26 #include <boost/fusion/view/filter_view/detail/value_of_data_impl.hpp>
27 #include <boost/fusion/view/filter_view/detail/key_of_impl.hpp>
28
29 namespace boost { namespace fusion
30 {
31 struct filter_view_iterator_tag;
32 struct forward_traversal_tag;
33
34 template <typename Category, typename First, typename Last, typename Pred>
35 struct filter_iterator : iterator_base<filter_iterator<Category, First, Last, Pred> >
36 {
37 typedef convert_iterator<First> first_converter;
38 typedef typename first_converter::type first_iter;
39 typedef convert_iterator<Last> last_converter;
40 typedef typename last_converter::type last_iter;
41
42 typedef filter_view_iterator_tag fusion_tag;
43 typedef Category category;
44 typedef
45 detail::static_find_if<
46 first_iter
47 , last_iter
48 , mpl::bind1<
49 typename mpl::lambda<Pred>::type
50 , mpl::bind1<mpl::quote1<result_of::value_of>,mpl::_1>
51 >
52 >
53 filter;
54 typedef typename filter::type first_type;
55 typedef last_iter last_type;
56 typedef Pred pred_type;
57
58 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
59 filter_iterator(First const& in_first)
60 : first(filter::iter_call(first_converter::call(in_first))) {}
61
62 first_type first;
63
64 private:
65 // silence MSVC warning C4512: assignment operator could not be generated
66 filter_iterator& operator= (filter_iterator const&);
67 };
68 }}
69
70 #ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
71 namespace std
72 {
73 template <typename Category, typename First, typename Last, typename Pred>
74 struct iterator_traits< ::boost::fusion::filter_iterator<Category, First, Last, Pred> >
75 { };
76 }
77 #endif
78
79 #endif
80
81