1 .. Algorithms/Transformation Algorithms//reverse_replace_if |150
15 , typename In = |unspecified|
17 struct reverse_replace_if
19 typedef |unspecified| type;
27 Returns a reversed copy of the original sequence where every type that satisfies
28 the predicate ``Pred`` has been replaced with ``NewType``.
30 |transformation algorithm disclaimer|
37 #include <boost/mpl/replace_if.hpp>
44 |Reversible Algorithm|
50 +---------------+-----------------------------------+-------------------------------+
51 | Parameter | Requirement | Description |
52 +===============+===================================+===============================+
53 | ``Sequence`` | |Forward Sequence| | An original sequence. |
54 +---------------+-----------------------------------+-------------------------------+
55 | ``Pred`` | Unary |Lambda Expression| | A replacement condition. |
56 +---------------+-----------------------------------+-------------------------------+
57 | ``NewType`` | Any type | A type to replace with. |
58 +---------------+-----------------------------------+-------------------------------+
59 | ``In`` | |Inserter| | An inserter. |
60 +---------------+-----------------------------------+-------------------------------+
66 |Semantics disclaimer...| |Reversible Algorithm|.
68 For any |Forward Sequence| ``s``, an unary |Lambda Expression| ``pred``,
69 an |Inserter| ``in``, and arbitrary type ``x``:
74 typedef reverse_replace_if<s,pred,x,in>::type r;
84 typedef lambda<pred>::type p;
85 typedef reverse_transform< s, if_< apply_wrap1<p,_1>,x,_1>, in >::type r;
91 Linear. Performs exactly ``size<s>::value`` applications of ``pred``, and at most
92 ``size<s>::value`` insertions.
100 typedef vector_c<int,1,4,5,2,7,5,3,5> numbers;
101 typedef vector_c<int,1,4,0,2,0,0,3,0> expected;
102 typedef reverse_replace_if<
104 , greater< _, int_<4> >
106 , front_inserter< vector<> >
109 BOOST_MPL_ASSERT(( equal< result,expected, equal_to<_,_> > ));
115 |Transformation Algorithms|, |Reversible Algorithm|, |replace_if|, |reverse_replace|, |remove_if|, |transform|
118 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
119 Distributed under the Boost Software License, Version 1.0. (See accompanying
120 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)