Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:48:02

0001 
0002 #ifndef BOOST_MPL_COUNT_IF_HPP_INCLUDED
0003 #define BOOST_MPL_COUNT_IF_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2002
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. 
0008 // (See accompanying file LICENSE_1_0.txt or copy at 
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // See http://www.boost.org/libs/mpl for documentation.
0012 
0013 // $Id$
0014 // $Date$
0015 // $Revision$
0016 
0017 #include <boost/mpl/fold.hpp>
0018 #include <boost/mpl/next.hpp>
0019 #include <boost/mpl/integral_c.hpp>
0020 #include <boost/mpl/identity.hpp>
0021 #include <boost/mpl/eval_if.hpp>
0022 #include <boost/mpl/apply.hpp>
0023 #include <boost/mpl/aux_/msvc_eti_base.hpp>
0024 #include <boost/mpl/aux_/na_spec.hpp>
0025 #include <boost/mpl/aux_/lambda_support.hpp>
0026 #include <boost/mpl/aux_/config/forwarding.hpp>
0027 
0028 namespace boost { namespace mpl {
0029 
0030 namespace aux {
0031 
0032 template< typename Predicate >
0033 struct next_if
0034 {
0035     template<
0036           typename N
0037         , typename T
0038         >
0039     struct apply
0040 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
0041         : eval_if<
0042               typename apply1<Predicate,T>::type
0043             , next<N>
0044             , identity<N>
0045             >
0046     {
0047 #else
0048     {
0049         typedef typename eval_if<
0050               typename apply1<Predicate,T>::type
0051             , next<N>
0052             , identity<N>
0053             >::type type;
0054 #endif
0055     };
0056 };
0057 
0058 } // namespace aux
0059 
0060 
0061 template<
0062       typename BOOST_MPL_AUX_NA_PARAM(Sequence)
0063     , typename BOOST_MPL_AUX_NA_PARAM(Predicate)
0064     >
0065 struct count_if
0066     : aux::msvc_eti_base< typename fold<
0067           Sequence
0068         , integral_c<unsigned long,0>
0069         , protect< aux::next_if<Predicate> >
0070         >::type >
0071 {
0072     BOOST_MPL_AUX_LAMBDA_SUPPORT(2,count_if,(Sequence,Predicate))
0073 };
0074 
0075 BOOST_MPL_AUX_NA_SPEC(2, count_if)
0076 
0077 }}
0078 
0079 #endif // BOOST_MPL_COUNT_IF_HPP_INCLUDED