Files
boost_mpl/include/boost/mpl/remove_if.hpp
T

84 lines
1.9 KiB
C++
Raw Normal View History

2003-03-12 10:53:42 +00:00
#ifndef BOOST_MPL_REMOVE_IF_HPP_INCLUDED
#define BOOST_MPL_REMOVE_IF_HPP_INCLUDED
2004-09-02 15:41:37 +00:00
// Copyright Aleksey Gurtovoy 2000-2004
// Copyright David Abrahams 2003-2004
2002-09-15 22:13:24 +00:00
//
2004-09-02 15:41:37 +00:00
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
2003-03-12 10:53:42 +00:00
//
// See http://www.boost.org/libs/mpl for documentation.
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
// $Source$
// $Date$
// $Revision$
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
#include <boost/mpl/fold.hpp>
#include <boost/mpl/reverse_fold.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/protect.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/aux_/inserter_algorithm.hpp>
namespace boost { namespace mpl {
2002-09-15 22:13:24 +00:00
namespace aux {
2004-09-02 15:41:37 +00:00
template< typename Pred, typename InsertOp > struct remove_if_helper
2002-09-15 22:13:24 +00:00
{
template< typename Sequence, typename U > struct apply
{
2004-09-02 15:41:37 +00:00
typedef typename eval_if<
2003-03-12 10:53:42 +00:00
typename apply1<Pred,U>::type
2002-09-15 22:13:24 +00:00
, identity<Sequence>
2004-09-02 15:41:37 +00:00
, apply2<InsertOp,Sequence,U>
2002-09-15 22:13:24 +00:00
>::type type;
};
};
template<
2004-09-02 15:41:37 +00:00
typename Sequence
, typename Predicate
, typename Inserter
2002-09-15 22:13:24 +00:00
>
2004-09-02 15:41:37 +00:00
struct remove_if_impl
: fold<
2002-09-15 22:13:24 +00:00
Sequence
2004-09-02 15:41:37 +00:00
, typename Inserter::state
, protect< aux::remove_if_helper<
typename lambda<Predicate>::type
, typename Inserter::operation
> >
>
{
2002-09-15 22:13:24 +00:00
};
2004-09-02 15:41:37 +00:00
template<
typename Sequence
, typename Predicate
, typename Inserter
>
struct reverse_remove_if_impl
: reverse_fold<
Sequence
, typename Inserter::state
, protect< aux::remove_if_helper<
typename lambda<Predicate>::type
, typename Inserter::operation
> >
>
{
};
2003-03-11 11:59:49 +00:00
2004-09-02 15:41:37 +00:00
} // namespace aux
2002-09-15 22:13:24 +00:00
2004-09-02 15:41:37 +00:00
BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, remove_if)
}}
2002-09-15 22:13:24 +00:00
#endif // BOOST_MPL_REMOVE_IF_HPP_INCLUDED