Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 #ifndef BOOST_MPL_COPY_IF_HPP_INCLUDED
0003 #define BOOST_MPL_COPY_IF_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2000-2004
0006 // Copyright David Abrahams 2003-2004
0007 //
0008 // Distributed under the Boost Software License, Version 1.0. 
0009 // (See accompanying file LICENSE_1_0.txt or copy at 
0010 // http://www.boost.org/LICENSE_1_0.txt)
0011 //
0012 // See http://www.boost.org/libs/mpl for documentation.
0013 
0014 // $Id$
0015 // $Date$
0016 // $Revision$
0017 
0018 #include <boost/mpl/fold.hpp>
0019 #include <boost/mpl/reverse_fold.hpp>
0020 #include <boost/mpl/apply.hpp>
0021 #include <boost/mpl/eval_if.hpp>
0022 #include <boost/mpl/identity.hpp>
0023 #include <boost/mpl/protect.hpp>
0024 #include <boost/mpl/aux_/inserter_algorithm.hpp>
0025 #include <boost/mpl/aux_/config/forwarding.hpp>
0026 
0027 namespace boost { namespace mpl {
0028 
0029 namespace aux {
0030 
0031 template<
0032       typename Operation
0033     , typename Predicate
0034     >
0035 struct copy_if_op
0036 {
0037     template< typename Sequence, typename T > struct apply
0038 #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
0039         : eval_if<
0040               typename apply1<Predicate,T>::type
0041             , apply2<Operation,Sequence,T>
0042             , identity<Sequence>
0043             >
0044     {
0045 #else
0046     {
0047         typedef typename eval_if<
0048               typename apply1<Predicate,T>::type
0049             , apply2<Operation,Sequence,T>
0050             , identity<Sequence>
0051             >::type type;
0052 #endif
0053     };
0054 };
0055 
0056 template<
0057       typename Sequence
0058     , typename Predicate
0059     , typename Inserter
0060     >
0061 struct copy_if_impl
0062     : fold<
0063           Sequence
0064         , typename Inserter::state
0065         , protect< aux::copy_if_op<
0066               typename Inserter::operation
0067             , Predicate
0068             > >
0069         >
0070 {
0071 };
0072 
0073 template<
0074       typename Sequence
0075     , typename Predicate
0076     , typename Inserter
0077     >
0078 struct reverse_copy_if_impl
0079     : reverse_fold<
0080           Sequence
0081         , typename Inserter::state
0082         , protect< aux::copy_if_op<
0083               typename Inserter::operation
0084             , Predicate
0085             > >
0086         >
0087 {
0088 };
0089 
0090 } // namespace aux
0091 
0092 BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, copy_if)
0093 
0094 }}
0095 
0096 #endif // BOOST_MPL_COPY_IF_HPP_INCLUDED