Back to Arangodb

reverse_replace

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/reverse-replace.html

3.12.9.13.3 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Algorithms / Transformation Algorithms / reverse_replace |

reverse_replace

Synopsis

template<
      typename Sequence
    , typename OldType
    , typename NewType
    , typename In =_unspecified_>
struct[reverse\_replace](./reverse-replace.html){
    typedef_unspecified_type;
};

Description

Returns a reversed copy of the original sequence where every type identical to OldType has been replaced with NewType.

[Note: This wording applies to a no-inserter version(s) of the algorithm. See the Expression semantics subsection for a precise specification of the algorithm's details in all cases — end note]

#include <[boost/mpl/replace.hpp](../../../../boost/mpl/replace.hpp)>

Model of

Reversible Algorithm

Parameters

ParameterRequirementDescription
SequenceForward SequenceA original sequence.
OldTypeAny typeA type to be replaced.
NewTypeAny typeA type to replace with.
InInserterAn inserter.

Expression semantics

The semantics of an expression are defined only where they differ from, or are not defined in Reversible Algorithm.

For any Forward Sequence s, an Inserter in, and arbitrary types x and y:

typedef[reverse\_replace](./reverse-replace.html)<s,x,y,in>::type r;

| Return type: |

A type.

| | Semantics: |

Equivalent to

typedef[reverse\_replace\_if](./reverse-replace-if.html)< s,y,is_same<_,x>,in >::type r;

|

Complexity

Linear. Performs exactly size<s>::value comparisons for identity / insertions.

Example

typedef[vector](./vector.html)<int,float,char,float,float,double> types;
typedef[vector](./vector.html)<double,double,double,char,double,int> expected;
typedef[reverse\_replace](./reverse-replace.html)< types,float,double >::type result;[BOOST\_MPL\_ASSERT](./assert.html)(([equal](./equal.html)< result,expected > ));

See also

Transformation Algorithms, Reversible Algorithm, replace, reverse_replace_if, remove, reverse_transform

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams 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) |