PageRenderTime 28ms CodeModel.GetById 19ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/src/contrib/boost/mpl/count_if.hpp

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