1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
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_NEXT_IMPL_06052005_0900)
8 #define FUSION_NEXT_IMPL_06052005_0900
10 #include <boost/fusion/support/config.hpp>
11 #include <boost/fusion/algorithm/query/detail/find_if.hpp>
12 #include <boost/fusion/iterator/value_of.hpp>
13 #include <boost/mpl/eval_if.hpp>
14 #include <boost/mpl/identity.hpp>
15 #include <boost/mpl/lambda.hpp>
16 #include <boost/mpl/quote.hpp>
17 #include <boost/mpl/bind.hpp>
18 #include <boost/mpl/placeholders.hpp>
20 namespace boost { namespace fusion
22 struct filter_view_iterator_tag;
24 template <typename Category, typename First, typename Last, typename Pred>
25 struct filter_iterator;
29 template <typename Tag>
33 struct next_impl<filter_view_iterator_tag>
35 template <typename Iterator>
38 typedef typename Iterator::first_type first_type;
39 typedef typename Iterator::last_type last_type;
40 typedef typename Iterator::pred_type pred_type;
41 typedef typename Iterator::category category;
45 result_of::equal_to<first_type, last_type>
46 , mpl::identity<last_type>
47 , result_of::next<first_type>
52 detail::static_find_if<
56 typename mpl::lambda<pred_type>::type
57 , mpl::bind1<mpl::quote1<result_of::value_of>,mpl::_1>
62 typedef filter_iterator<
63 category, typename filter::type, last_type, pred_type>
66 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
68 call(Iterator const& i)
70 return type(filter::iter_call(i.first));