1 .. Algorithms/Transformation Algorithms//replace |40
15 , typename In = |unspecified|
19 typedef |unspecified| type;
27 Returns a copy of the original sequence where every type identical to ``OldType``
28 has been replaced with ``NewType``.
30 |transformation algorithm disclaimer|
37 #include <boost/mpl/replace.hpp>
43 |Reversible Algorithm|
49 +---------------+-----------------------------------+-------------------------------+
50 | Parameter | Requirement | Description |
51 +===============+===================================+===============================+
52 | ``Sequence`` | |Forward Sequence| | A original sequence. |
53 +---------------+-----------------------------------+-------------------------------+
54 | ``OldType`` | Any type | A type to be replaced. |
55 +---------------+-----------------------------------+-------------------------------+
56 | ``NewType`` | Any type | A type to replace with. |
57 +---------------+-----------------------------------+-------------------------------+
58 | ``In`` | |Inserter| | An inserter. |
59 +---------------+-----------------------------------+-------------------------------+
65 |Semantics disclaimer...| |Reversible Algorithm|.
67 For any |Forward Sequence| ``s``, an |Inserter| ``in``, and arbitrary types ``x`` and ``y``:
72 typedef replace<s,x,y,in>::type r;
82 typedef replace_if< s,y,is_same<_,x>,in >::type r;
88 Linear. Performs exactly ``size<s>::value`` comparisons for
89 identity / insertions.
97 typedef vector<int,float,char,float,float,double> types;
98 typedef vector<int,double,char,double,double,double> expected;
99 typedef replace< types,float,double >::type result;
101 BOOST_MPL_ASSERT(( equal< result,expected > ));
107 |Transformation Algorithms|, |Reversible Algorithm|, |reverse_replace|, |replace_if|, |remove|, |transform|
110 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
111 Distributed under the Boost Software License, Version 1.0. (See accompanying
112 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)