.. Algorithms/Transformation Algorithms//reverse_transform |130 reverse_transform ================= Synopsis -------- .. parsed-literal:: template< typename Seq , typename Op , typename In = |unspecified| > struct reverse_transform { typedef |unspecified| type; }; template< typename Seq1 , typename Seq2 , typename BinaryOp , typename In = |unspecified| > struct reverse_transform { typedef |unspecified| type; }; Description ----------- ``reverse_transform`` is an |overloaded name|: * ``reverse_transform`` returns a reversed, transformed copy of the original sequence produced by applying an unary transformation ``Op`` to every element in the |begin/end| range. * ``reverse_transform`` returns a new sequence produced by applying a binary transformation ``BinaryOp`` to a pair of elements (e\ :sub:`1`, e2\ :sub:`1`) from the corresponding |begin/end| and |begin/end| ranges in reverse order. |transformation algorithm disclaimer| Header ------ .. parsed-literal:: #include Model of -------- |Reversible Algorithm| Parameters ---------- +-------------------+-----------------------------------+-----------------------------------+ | Parameter | Requirement | Description | +===================+===================================+===================================+ | ``Sequence``, | |Forward Sequence| | Sequences to transform. | | ``Seq1``, ``Seq2``| | | +-------------------+-----------------------------------+-----------------------------------+ | ``Op``, | |Lambda Expression| | A transformation. | | ``BinaryOp`` | | | +-------------------+-----------------------------------+-----------------------------------+ | ``In`` | |Inserter| | An inserter. | +-------------------+-----------------------------------+-----------------------------------+ Expression semantics -------------------- |Semantics disclaimer...| |Reversible Algorithm|. For any |Forward Sequence|\ s ``s``, ``s1`` and ``s2``, |Lambda Expression|\ s ``op`` and ``op2``, and an |Inserter| ``in``: .. parsed-literal:: typedef reverse_transform::type r; :Return type: A type. :Postcondition: Equivalent to .. parsed-literal:: typedef lambda::type f; typedef lambda::type in_op; typedef reverse_fold< s , in::state , bind< in_op, _1, bind > >::type r; .. parsed-literal:: typedef transform::type r; :Return type: A type. :Postcondition: Equivalent to .. parsed-literal:: typedef lambda::type f; typedef lambda::type in_op; typedef reverse_fold< pair_view , in::state , bind< in_op , _1 , bind,_2>, bind,_2> > > >::type r; Complexity ---------- Linear. Exactly ``size::value`` / ``size::value`` applications of ``op`` / ``op2`` and ``in::operation``. Example ------- .. parsed-literal:: typedef vector types; typedef vector pointers; typedef reverse_transform< types,boost::add_pointer<_1> >::type result; BOOST_MPL_ASSERT(( equal )); See also -------- |Transformation Algorithms|, |Reversible Algorithm|, |transform|, |reverse_copy|, |replace_if| .. copyright:: 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)