~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to boost/boost/mpl/remove_if.hpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#ifndef BOOST_MPL_REMOVE_IF_HPP_INCLUDED
 
3
#define BOOST_MPL_REMOVE_IF_HPP_INCLUDED
 
4
 
 
5
// + file: boost/mpl/remove_if.hpp
 
6
// + last modified: 10/mar/03
 
7
 
 
8
// Copyright (c) 2000-03
 
9
// Aleksey Gurtovoy
 
10
//
 
11
// Permission to use, copy, modify, distribute and sell this software
 
12
// and its documentation for any purpose is hereby granted without fee, 
 
13
// provided that the above copyright notice appears in all copies and 
 
14
// that both the copyright notice and this permission notice appear in 
 
15
// supporting documentation. No representations are made about the 
 
16
// suitability of this software for any purpose. It is provided "as is" 
 
17
// without express or implied warranty.
 
18
//
 
19
// See http://www.boost.org/libs/mpl for documentation.
 
20
 
 
21
#include "boost/mpl/fold_backward.hpp"
 
22
#include "boost/mpl/clear.hpp"
 
23
#include "boost/mpl/apply_if.hpp"
 
24
#include "boost/mpl/push_front.hpp"
 
25
#include "boost/mpl/identity.hpp"
 
26
#include "boost/mpl/protect.hpp"
 
27
#include "boost/mpl/lambda.hpp"
 
28
#include "boost/mpl/aux_/void_spec.hpp"
 
29
 
 
30
namespace boost {
 
31
namespace mpl {
 
32
 
 
33
namespace aux {
 
34
 
 
35
template< typename Pred > struct remove_if_helper
 
36
{
 
37
    template< typename Sequence, typename U > struct apply
 
38
    {
 
39
        typedef typename apply_if<
 
40
              typename apply1<Pred,U>::type
 
41
            , identity<Sequence>
 
42
            , push_front<Sequence,U>
 
43
            >::type type;
 
44
    };
 
45
};
 
46
 
 
47
} // namespace aux
 
48
 
 
49
BOOST_MPL_AUX_AGLORITHM_NAMESPACE_BEGIN
 
50
 
 
51
template<
 
52
      typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Sequence)
 
53
    , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Predicate)
 
54
    >
 
55
struct remove_if
 
56
{
 
57
 private:
 
58
    typedef typename lambda<Predicate>::type pred_;
 
59
 
 
60
 public:
 
61
    typedef typename fold_backward<
 
62
          Sequence
 
63
        , typename clear<Sequence>::type
 
64
        , protect< aux::remove_if_helper<pred_> >
 
65
        >::type type;
 
66
};
 
67
 
 
68
BOOST_MPL_AUX_AGLORITHM_NAMESPACE_END
 
69
 
 
70
BOOST_MPL_AUX_ALGORITHM_VOID_SPEC(2, remove_if)
 
71
 
 
72
} // namespace mpl
 
73
} // namespace boost
 
74
 
 
75
#endif // BOOST_MPL_REMOVE_IF_HPP_INCLUDED