Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/boost/mpl/replace_if.hpp @ 18

Last change on this file since 18 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.8 KB
Line 
1
2#ifndef BOOST_MPL_REPLACE_IF_HPP_INCLUDED
3#define BOOST_MPL_REPLACE_IF_HPP_INCLUDED
4
5// Copyright Aleksey Gurtovoy 2000-2004
6// Copyright John R. Bandela 2000-2002
7// Copyright David Abrahams 2003-2004
8//
9// Distributed under the Boost Software License, Version 1.0.
10// (See accompanying file LICENSE_1_0.txt or copy at
11// http://www.boost.org/LICENSE_1_0.txt)
12//
13// See http://www.boost.org/libs/mpl for documentation.
14
15// $Source: /cvsroot/boost/boost/boost/mpl/replace_if.hpp,v $
16// $Date: 2004/11/28 01:57:09 $
17// $Revision: 1.7 $
18
19#include <boost/mpl/transform.hpp>
20#include <boost/mpl/apply.hpp>
21#include <boost/mpl/if.hpp>
22#include <boost/mpl/aux_/inserter_algorithm.hpp>
23#include <boost/mpl/aux_/config/forwarding.hpp>
24
25namespace boost { namespace mpl {
26
27namespace aux {
28
29template< typename Predicate, typename T >
30struct replace_if_op
31{
32    template< typename U > struct apply
33#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING)
34        : if_<
35              typename apply1<Predicate,U>::type
36            , T
37            , U
38            >
39    {
40#else
41    {
42        typedef typename if_<
43              typename apply1<Predicate,U>::type
44            , T
45            , U
46            >::type type;
47#endif
48    };
49};
50
51
52template<
53      typename Sequence
54    , typename Predicate
55    , typename T
56    , typename Inserter
57    >
58struct replace_if_impl
59    : transform1_impl<
60          Sequence
61        , protect< aux::replace_if_op<Predicate,T> >
62        , Inserter
63        >
64{
65};
66
67template<
68      typename Sequence
69    , typename Predicate
70    , typename T
71    , typename Inserter
72    >
73struct reverse_replace_if_impl
74    : reverse_transform1_impl<
75          Sequence
76        , protect< aux::replace_if_op<Predicate,T> >
77        , Inserter
78        >
79{
80};
81
82} // namespace aux
83
84BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(4, replace_if)
85
86}}
87
88#endif // BOOST_MPL_REPLACE_IF_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.