sl@0
|
1 |
|
sl@0
|
2 |
#ifndef BOOST_MPL_COUNT_IF_HPP_INCLUDED
|
sl@0
|
3 |
#define BOOST_MPL_COUNT_IF_HPP_INCLUDED
|
sl@0
|
4 |
|
sl@0
|
5 |
// Copyright Aleksey Gurtovoy 2000-2002
|
sl@0
|
6 |
//
|
sl@0
|
7 |
// Distributed under the Boost Software License, Version 1.0.
|
sl@0
|
8 |
// (See accompanying file LICENSE_1_0.txt or copy at
|
sl@0
|
9 |
// http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// See http://www.boost.org/libs/mpl for documentation.
|
sl@0
|
12 |
|
sl@0
|
13 |
// $Source: /cvsroot/boost/boost/boost/mpl/count_if.hpp,v $
|
sl@0
|
14 |
// $Date: 2004/09/02 15:40:41 $
|
sl@0
|
15 |
// $Revision: 1.5 $
|
sl@0
|
16 |
|
sl@0
|
17 |
#include <boost/mpl/fold.hpp>
|
sl@0
|
18 |
#include <boost/mpl/next.hpp>
|
sl@0
|
19 |
#include <boost/mpl/integral_c.hpp>
|
sl@0
|
20 |
#include <boost/mpl/identity.hpp>
|
sl@0
|
21 |
#include <boost/mpl/eval_if.hpp>
|
sl@0
|
22 |
#include <boost/mpl/apply.hpp>
|
sl@0
|
23 |
#include <boost/mpl/aux_/msvc_eti_base.hpp>
|
sl@0
|
24 |
#include <boost/mpl/aux_/na_spec.hpp>
|
sl@0
|
25 |
#include <boost/mpl/aux_/lambda_support.hpp>
|
sl@0
|
26 |
#include <boost/mpl/aux_/config/forwarding.hpp>
|
sl@0
|
27 |
|
sl@0
|
28 |
namespace boost { namespace mpl {
|
sl@0
|
29 |
|
sl@0
|
30 |
namespace aux {
|
sl@0
|
31 |
|
sl@0
|
32 |
template< typename Predicate >
|
sl@0
|
33 |
struct next_if
|
sl@0
|
34 |
{
|
sl@0
|
35 |
template<
|
sl@0
|
36 |
typename N
|
sl@0
|
37 |
, typename T
|
sl@0
|
38 |
>
|
sl@0
|
39 |
struct apply
|
sl@0
|
40 |
#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
|
sl@0
|
41 |
: eval_if<
|
sl@0
|
42 |
typename apply1<Predicate,T>::type
|
sl@0
|
43 |
, next<N>
|
sl@0
|
44 |
, identity<N>
|
sl@0
|
45 |
>
|
sl@0
|
46 |
{
|
sl@0
|
47 |
#else
|
sl@0
|
48 |
{
|
sl@0
|
49 |
typedef typename eval_if<
|
sl@0
|
50 |
typename apply1<Predicate,T>::type
|
sl@0
|
51 |
, next<N>
|
sl@0
|
52 |
, identity<N>
|
sl@0
|
53 |
>::type type;
|
sl@0
|
54 |
#endif
|
sl@0
|
55 |
};
|
sl@0
|
56 |
};
|
sl@0
|
57 |
|
sl@0
|
58 |
} // namespace aux
|
sl@0
|
59 |
|
sl@0
|
60 |
|
sl@0
|
61 |
template<
|
sl@0
|
62 |
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
|
sl@0
|
63 |
, typename BOOST_MPL_AUX_NA_PARAM(Predicate)
|
sl@0
|
64 |
>
|
sl@0
|
65 |
struct count_if
|
sl@0
|
66 |
: aux::msvc_eti_base< typename fold<
|
sl@0
|
67 |
Sequence
|
sl@0
|
68 |
, integral_c<unsigned long,0>
|
sl@0
|
69 |
, protect< aux::next_if<Predicate> >
|
sl@0
|
70 |
>::type >
|
sl@0
|
71 |
{
|
sl@0
|
72 |
BOOST_MPL_AUX_LAMBDA_SUPPORT(2,count_if,(Sequence,Predicate))
|
sl@0
|
73 |
};
|
sl@0
|
74 |
|
sl@0
|
75 |
BOOST_MPL_AUX_NA_SPEC(2, count_if)
|
sl@0
|
76 |
|
sl@0
|
77 |
}}
|
sl@0
|
78 |
|
sl@0
|
79 |
#endif // BOOST_MPL_COUNT_IF_HPP_INCLUDED
|