blob: f7dea01c259cb96500004c8eaffedded832cc108 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
<title>The MPL Reference Manual: Transformation Algorithms</title>
<link rel="stylesheet" href="../style.css" type="text/css" />
</head>
<body class="docframe refmanual">
<table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./equal.html" class="navigation-link">Prev</a>&nbsp;<a href="./copy.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./querying-algorithms.html" class="navigation-link">Back</a>&nbsp;<a href="./runtime-algorithms.html" class="navigation-link">Along</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./algorithms.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
<td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./algorithms.html" class="navigation-link">Algorithms</a> / <a href="./transformation-algorithms.html" class="navigation-link">Transformation Algorithms</a></td>
</tr></table><div class="header-separator"></div>
<div class="section" id="transformation-algorithms">
<h1><a class="toc-backref" href="./algorithms.html#id1485">Transformation Algorithms</a></h1>
<p id="label-algorithms-transformation-algorithms">According to their name, MPL's <em>transformation</em>, or <em>sequence-building
algorithms</em> provide the tools for building new sequences from the existing
ones by performing some kind of transformation. A typical transformation
alogrithm takes one or more input sequences and a transformation
metafunction/predicate, and returns a new sequence built according to the
algorithm's semantics through the means of its <a class="reference internal" href="./inserter.html">Inserter</a> argument, which
plays a role similar to the role of run-time <a class="reference external" href="http://www.sgi.com/tech/stl/OutputIterator.html" target="_top">Output Iterator</a>.</p>
<!-- Say something about optionality of Inserters/their default behavior -->
<p>Every transformation algorithm is a <a class="reference internal" href="./reversible-algorithm.html">Reversible Algorithm</a>, providing
an accordingly named <tt class="literal"><span class="pre">reverse_</span></tt> counterpart carrying the transformation
in the reverse order. Thus, all sequence-building algorithms come in pairs,
for instance <tt class="literal"><span class="pre"><a href="./replace.html" class="identifier">replace</a></span></tt> / <tt class="literal"><span class="pre"><a href="./reverse-replace.html" class="identifier">reverse_replace</a></span></tt>. In presence of variability of
the output sequence's properties such as front or backward extensibility,
the existence of the bidirectional algorithms allows for the most efficient
way to perform the required transformation.</p>
<!-- Algorithms/Transformation Algorithms//copy |10 -->
<ul class="toc simple" id="outline">
<li><a class="reference internal" href="./copy.html" id="id1486">copy</a></li>
<li><a class="reference internal" href="./copy-if.html" id="id1487">copy_if</a></li>
<li><a class="reference internal" href="./transform.html" id="id1488">transform</a></li>
<li><a class="reference internal" href="./replace.html" id="id1489">replace</a></li>
<li><a class="reference internal" href="./replace-if.html" id="id1490">replace_if</a></li>
<li><a class="reference internal" href="./remove.html" id="id1491">remove</a></li>
<li><a class="reference internal" href="./remove-if.html" id="id1492">remove_if</a></li>
<li><a class="reference internal" href="./unique.html" id="id1493">unique</a></li>
<li><a class="reference internal" href="./partition.html" id="id1494">partition</a></li>
<li><a class="reference internal" href="./stable-partition.html" id="id1495">stable_partition</a></li>
<li><a class="reference internal" href="./sort.html" id="id1496">sort</a></li>
<li><a class="reference internal" href="./reverse.html" id="id1497">reverse</a></li>
<li><a class="reference internal" href="./reverse-copy.html" id="id1498">reverse_copy</a></li>
<li><a class="reference internal" href="./reverse-copy-if.html" id="id1499">reverse_copy_if</a></li>
<li><a class="reference internal" href="./reverse-transform.html" id="id1500">reverse_transform</a></li>
<li><a class="reference internal" href="./reverse-replace.html" id="id1501">reverse_replace</a></li>
<li><a class="reference internal" href="./reverse-replace-if.html" id="id1502">reverse_replace_if</a></li>
<li><a class="reference internal" href="./reverse-remove.html" id="id1503">reverse_remove</a></li>
<li><a class="reference internal" href="./reverse-remove-if.html" id="id1504">reverse_remove_if</a></li>
<li><a class="reference internal" href="./reverse-unique.html" id="id1505">reverse_unique</a></li>
<li><a class="reference internal" href="./reverse-partition.html" id="id1506">reverse_partition</a></li>
<li><a class="reference internal" href="./reverse-stable-partition.html" id="id1507">reverse_stable_partition</a></li>
</ul>
</div>
<div class="footer-separator"></div>
<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./equal.html" class="navigation-link">Prev</a>&nbsp;<a href="./copy.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./querying-algorithms.html" class="navigation-link">Back</a>&nbsp;<a href="./runtime-algorithms.html" class="navigation-link">Along</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./algorithms.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
<td><div class="copyright-footer"><div class="copyright">Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams</div>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</div></td></tr></table></body>
</html>