]>
Commit | Line | Data |
---|---|---|
1 | /*============================================================================= | |
2 | Copyright (c) 2001-2011 Joel de Guzman | |
3 | Copyright (c) 2007 Dan Marsden | |
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(BOOST_FUSION_COUNT_IF_09162005_0137) | |
9 | #define BOOST_FUSION_COUNT_IF_09162005_0137 | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
12 | #include <boost/fusion/algorithm/query/detail/count_if.hpp> | |
13 | #include <boost/fusion/support/category_of.hpp> | |
14 | #include <boost/fusion/support/is_sequence.hpp> | |
15 | #include <boost/utility/enable_if.hpp> | |
16 | ||
17 | namespace boost { namespace fusion | |
18 | { | |
19 | namespace result_of | |
20 | { | |
21 | template <typename Sequence, typename F> | |
22 | struct count_if | |
23 | { | |
24 | typedef int type; | |
25 | }; | |
26 | } | |
27 | ||
28 | template <typename Sequence, typename F> | |
29 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
30 | inline typename | |
31 | enable_if< | |
32 | traits::is_sequence<Sequence> | |
33 | , int | |
34 | >::type | |
35 | count_if(Sequence const& seq, F f) | |
36 | { | |
37 | return detail::count_if( | |
38 | seq, f, typename traits::category_of<Sequence>::type()); | |
39 | } | |
40 | }} | |
41 | ||
42 | #endif | |
43 |