forked from boostorg/range
Boost.RangeEx merged into Boost.Range
[SVN r60897]
This commit is contained in:
@ -0,0 +1,157 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>accumulate</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
|
||||
<link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0">
|
||||
<link rel="up" href="../range_numeric.html" title="Numeric algorithms">
|
||||
<link rel="prev" href="../range_numeric.html" title="Numeric algorithms">
|
||||
<link rel="next" href="adjacent_difference.html" title="adjacent_difference">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="adjacent_difference.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" title="accumulate">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="range.reference.algorithms.range_numeric.accumulate"></a><a class="link" href="accumulate.html" title="accumulate">
|
||||
accumulate</a>
|
||||
</h5></div></div></div>
|
||||
<a name="range.reference.algorithms.range_numeric.accumulate.prototype"></a><h6>
|
||||
<a name="id3259323"></a>
|
||||
<a class="link" href="accumulate.html#range.reference.algorithms.range_numeric.accumulate.prototype">Prototype</a>
|
||||
</h6>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span>
|
||||
<span class="keyword">class</span> <span class="identifier">SinglePassRange</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">Value</span>
|
||||
<span class="special">></span>
|
||||
<span class="identifier">Value</span> <span class="identifier">accumulate</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SinglePassRange</span><span class="special">&</span> <span class="identifier">source_rng</span><span class="special">,</span>
|
||||
<span class="identifier">Value</span> <span class="identifier">init</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span>
|
||||
<span class="keyword">class</span> <span class="identifier">SinglePassRange</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">Value</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">BinaryOperation</span>
|
||||
<span class="special">></span>
|
||||
<span class="identifier">Value</span> <span class="identifier">accumulate</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SinglePassRange</span><span class="special">&</span> <span class="identifier">source_rng</span><span class="special">,</span>
|
||||
<span class="identifier">Value</span> <span class="identifier">init</span><span class="special">,</span>
|
||||
<span class="identifier">BinaryOperation</span> <span class="identifier">op</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.accumulate.description"></a><h6>
|
||||
<a name="id3259589"></a>
|
||||
<a class="link" href="accumulate.html#range.reference.algorithms.range_numeric.accumulate.description">Description</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">accumulate</span></code> is a generalisation
|
||||
of summation. It computes a binary operation (<code class="computeroutput"><span class="keyword">operator</span><span class="special">+</span></code> in the non-predicate version) of <code class="computeroutput"><span class="identifier">init</span></code> and all of the elements in <code class="computeroutput"><span class="identifier">rng</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The return value is the resultant value of the above algorithm.
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.accumulate.definition"></a><h6>
|
||||
<a name="id3259669"></a>
|
||||
<a class="link" href="accumulate.html#range.reference.algorithms.range_numeric.accumulate.definition">Definition</a>
|
||||
</h6>
|
||||
<p>
|
||||
Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">numeric</span><span class="special">.</span><span class="identifier">hpp</span></code>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.accumulate.requirements"></a><h6>
|
||||
<a name="id3259733"></a>
|
||||
<a class="link" href="accumulate.html#range.reference.algorithms.range_numeric.accumulate.requirements">Requirements</a>
|
||||
</h6>
|
||||
<a name="range.reference.algorithms.range_numeric.accumulate.for_the_first_version"></a><h6>
|
||||
<a name="id3259756"></a>
|
||||
<a class="link" href="accumulate.html#range.reference.algorithms.range_numeric.accumulate.for_the_first_version">For
|
||||
the first version</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">Value</span></code> is a model of
|
||||
the <code class="computeroutput"><span class="identifier">AssignableConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An <code class="computeroutput"><span class="keyword">operator</span><span class="special">+</span></code>
|
||||
is defined for a left-hand operand of type <code class="computeroutput"><span class="identifier">Value</span></code>
|
||||
and a right-hand operance of the <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>
|
||||
value type.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The return type of the above operator is convertible to <code class="computeroutput"><span class="identifier">Value</span></code>.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.accumulate.for_the_second_version"></a><h6>
|
||||
<a name="id3259894"></a>
|
||||
<a class="link" href="accumulate.html#range.reference.algorithms.range_numeric.accumulate.for_the_second_version">For
|
||||
the second version</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">Value</span></code> is a model of
|
||||
the <code class="computeroutput"><span class="identifier">AssignableConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BinaryOperation</span></code> is
|
||||
a model of the <code class="computeroutput"><span class="identifier">BinaryFunctionConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">Value</span></code> is convertible
|
||||
to <code class="computeroutput"><span class="identifier">BinaryOperation</span></code>'s
|
||||
first argument type.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange</span></code>'s value
|
||||
type is convertible to <code class="computeroutput"><span class="identifier">BinaryOperation</span></code>'s
|
||||
second argument type.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The return type of <code class="computeroutput"><span class="identifier">BinaryOperation</span></code>
|
||||
is convertible to <code class="computeroutput"><span class="identifier">Value</span></code>.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.accumulate.complexity"></a><h6>
|
||||
<a name="id3260078"></a>
|
||||
<a class="link" href="accumulate.html#range.reference.algorithms.range_numeric.accumulate.complexity">Complexity</a>
|
||||
</h6>
|
||||
<p>
|
||||
Linear. Exactly <code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">source_rng</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003 -2010 Thorsten Ottosen, Neil Groves<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="adjacent_difference.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,179 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>adjacent_difference</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
|
||||
<link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0">
|
||||
<link rel="up" href="../range_numeric.html" title="Numeric algorithms">
|
||||
<link rel="prev" href="accumulate.html" title="accumulate">
|
||||
<link rel="next" href="inner_product.html" title="inner_product">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="accumulate.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="inner_product.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" title="adjacent_difference">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference"></a><a class="link" href="adjacent_difference.html" title="adjacent_difference">
|
||||
adjacent_difference</a>
|
||||
</h5></div></div></div>
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference.prototype"></a><h6>
|
||||
<a name="id3260149"></a>
|
||||
<a class="link" href="adjacent_difference.html#range.reference.algorithms.range_numeric.adjacent_difference.prototype">Prototype</a>
|
||||
</h6>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span>
|
||||
<span class="keyword">class</span> <span class="identifier">SinglePassRange</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">OutputIterator</span>
|
||||
<span class="special">></span>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">adjacent_difference</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">SinglePassRange</span><span class="special">&</span> <span class="identifier">source_rng</span><span class="special">,</span>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span>
|
||||
<span class="keyword">class</span> <span class="identifier">SinglePassRange</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">BinaryOperation</span>
|
||||
<span class="special">></span>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">adjacent_difference</span><span class="special">(</span>
|
||||
<span class="keyword">const</span> <span class="identifier">SinglePassRange</span><span class="special">&</span> <span class="identifier">source_rng</span><span class="special">,</span>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">,</span>
|
||||
<span class="identifier">BinaryOperation</span> <span class="identifier">op</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference.description"></a><h6>
|
||||
<a name="id3260417"></a>
|
||||
<a class="link" href="adjacent_difference.html#range.reference.algorithms.range_numeric.adjacent_difference.description">Description</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">adjacent_difference</span></code> calculates
|
||||
the differences of adjacent_elements in <code class="computeroutput"><span class="identifier">rng</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The first version of <code class="computeroutput"><span class="identifier">adjacent_difference</span></code>
|
||||
uses <code class="computeroutput"><span class="keyword">operator</span><span class="special">-()</span></code>
|
||||
to calculate the differences. The second version uses <code class="computeroutput"><span class="identifier">BinaryOperation</span></code>
|
||||
instead of <code class="computeroutput"><span class="keyword">operator</span><span class="special">-()</span></code>.
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference.definition"></a><h6>
|
||||
<a name="id3260522"></a>
|
||||
<a class="link" href="adjacent_difference.html#range.reference.algorithms.range_numeric.adjacent_difference.definition">Definition</a>
|
||||
</h6>
|
||||
<p>
|
||||
Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">numeric</span><span class="special">.</span><span class="identifier">hpp</span></code>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference.requirements"></a><h6>
|
||||
<a name="id3260587"></a>
|
||||
<a class="link" href="adjacent_difference.html#range.reference.algorithms.range_numeric.adjacent_difference.requirements">Requirements</a>
|
||||
</h6>
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference.for_the_first_version"></a><h6>
|
||||
<a name="id3260611"></a>
|
||||
<a class="link" href="adjacent_difference.html#range.reference.algorithms.range_numeric.adjacent_difference.for_the_first_version">For
|
||||
the first version</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">OutputIterator</span></code> is a
|
||||
model of the <code class="computeroutput"><span class="identifier">OutputIteratorConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
If <code class="computeroutput"><span class="identifier">x</span></code> and <code class="computeroutput"><span class="identifier">y</span></code> are objects of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>'s
|
||||
value type, then <code class="computeroutput"><span class="identifier">x</span> <span class="special">-</span> <span class="identifier">y</span></code>
|
||||
is defined.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The value type of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>
|
||||
is convertible to a type in <code class="computeroutput"><span class="identifier">OutputIterator</span></code>'s
|
||||
set of value types.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The return type of <code class="computeroutput"><span class="identifier">x</span> <span class="special">-</span> <span class="identifier">y</span></code>
|
||||
is convertible to a type in <code class="computeroutput"><span class="identifier">OutputIterator</span></code>'s
|
||||
set of value types.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference.for_the_second_version"></a><h6>
|
||||
<a name="id3260814"></a>
|
||||
<a class="link" href="adjacent_difference.html#range.reference.algorithms.range_numeric.adjacent_difference.for_the_second_version">For
|
||||
the second version</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">OutputIterator</span></code> is a
|
||||
model of the <code class="computeroutput"><span class="identifier">OutputIteratorConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BinaryOperation</span></code> is
|
||||
a model of the <code class="computeroutput"><span class="identifier">BinaryFunctionConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The value type of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>
|
||||
is convertible to <code class="computeroutput"><span class="identifier">BinaryOperation</span></code>'s
|
||||
first and second argument types.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The value type of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>
|
||||
is convertible to a type in <code class="computeroutput"><span class="identifier">OutputIterator</span></code>'s
|
||||
set of value types.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The result type of <code class="computeroutput"><span class="identifier">BinaryOperation</span></code>
|
||||
is convertible to a type in <code class="computeroutput"><span class="identifier">OutputIterator</span></code>'s
|
||||
set of value types.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference.precondition_"></a><h6>
|
||||
<a name="id3261002"></a>
|
||||
<a class="link" href="adjacent_difference.html#range.reference.algorithms.range_numeric.adjacent_difference.precondition_">Precondition:</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">[</span><span class="identifier">result</span><span class="special">,</span> <span class="identifier">result</span>
|
||||
<span class="special">+</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng</span><span class="special">))</span></code> is a valid range.
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.adjacent_difference.complexity"></a><h6>
|
||||
<a name="id3261079"></a>
|
||||
<a class="link" href="adjacent_difference.html#range.reference.algorithms.range_numeric.adjacent_difference.complexity">Complexity</a>
|
||||
</h6>
|
||||
<p>
|
||||
Linear. If <code class="computeroutput"><span class="identifier">empty</span><span class="special">(</span><span class="identifier">rng</span><span class="special">)</span></code>
|
||||
then zero applications, otherwise <code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng</span><span class="special">)</span> <span class="special">-</span> <span class="number">1</span></code>
|
||||
applications are performed.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003 -2010 Thorsten Ottosen, Neil Groves<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="accumulate.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="inner_product.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,192 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>inner_product</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
|
||||
<link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0">
|
||||
<link rel="up" href="../range_numeric.html" title="Numeric algorithms">
|
||||
<link rel="prev" href="adjacent_difference.html" title="adjacent_difference">
|
||||
<link rel="next" href="partial_sum.html" title="partial_sum">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="adjacent_difference.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="partial_sum.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" title="inner_product">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product"></a><a class="link" href="inner_product.html" title="inner_product">
|
||||
inner_product</a>
|
||||
</h5></div></div></div>
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product.prototype"></a><h6>
|
||||
<a name="id3261186"></a>
|
||||
<a class="link" href="inner_product.html#range.reference.algorithms.range_numeric.inner_product.prototype">Prototype</a>
|
||||
</h6>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">SinglePassRange1</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">SinglePassRange2</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">Value</span><span class="special">></span>
|
||||
<span class="identifier">Value</span> <span class="identifier">inner_product</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">SinglePassRange1</span><span class="special">&</span> <span class="identifier">rng1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">SinglePassRange2</span><span class="special">&</span> <span class="identifier">rng2</span><span class="special">,</span>
|
||||
<span class="identifier">Value</span> <span class="identifier">init</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">SinglePassRange1</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">SinglePassRange2</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">Value</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">BinaryOperation1</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">BinaryOperation2</span><span class="special">></span>
|
||||
<span class="identifier">Value</span> <span class="identifier">inner_product</span><span class="special">(</span> <span class="keyword">const</span> <span class="identifier">SinglePassRange1</span><span class="special">&</span> <span class="identifier">rng1</span><span class="special">,</span>
|
||||
<span class="keyword">const</span> <span class="identifier">SinglePassRange2</span><span class="special">&</span> <span class="identifier">rng2</span><span class="special">,</span>
|
||||
<span class="identifier">Value</span> <span class="identifier">init</span><span class="special">,</span>
|
||||
<span class="identifier">BinaryOperation1</span> <span class="identifier">op1</span><span class="special">,</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product.description"></a><h6>
|
||||
<a name="id3261550"></a>
|
||||
<a class="link" href="inner_product.html#range.reference.algorithms.range_numeric.inner_product.description">Description</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">inner_product</span></code> calculates
|
||||
a generalised inner product of the range <code class="computeroutput"><span class="identifier">rng1</span></code>
|
||||
and <code class="computeroutput"><span class="identifier">rng2</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
For further information on the <code class="computeroutput"><span class="identifier">inner_product</span></code>
|
||||
algorithm please see <a href="http://www.sgi.com/tech/stl/inner_product.html" target="_top">inner_product</a>.
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product.definition"></a><h6>
|
||||
<a name="id3261632"></a>
|
||||
<a class="link" href="inner_product.html#range.reference.algorithms.range_numeric.inner_product.definition">Definition</a>
|
||||
</h6>
|
||||
<p>
|
||||
Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">numeric</span><span class="special">.</span><span class="identifier">hpp</span></code>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product.requirements"></a><h6>
|
||||
<a name="id3261697"></a>
|
||||
<a class="link" href="inner_product.html#range.reference.algorithms.range_numeric.inner_product.requirements">Requirements</a>
|
||||
</h6>
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product.for_the_first_version"></a><h6>
|
||||
<a name="id3261721"></a>
|
||||
<a class="link" href="inner_product.html#range.reference.algorithms.range_numeric.inner_product.for_the_first_version">For
|
||||
the first version</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange1</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange2</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">Value</span></code> is a model of
|
||||
the <code class="computeroutput"><span class="identifier">AssignableConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
If <code class="computeroutput"><span class="identifier">x</span></code> is an object of
|
||||
type <code class="computeroutput"><span class="identifier">Value</span></code>, <code class="computeroutput"><span class="identifier">y</span></code> is an object of <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>'s
|
||||
value type, and <code class="computeroutput"><span class="identifier">z</span></code> is
|
||||
an object of <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>'s
|
||||
value type, then <code class="computeroutput"><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span> <span class="special">*</span> <span class="identifier">z</span></code>
|
||||
is defined.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The result type of the expression <code class="computeroutput"><span class="identifier">x</span>
|
||||
<span class="special">+</span> <span class="identifier">y</span>
|
||||
<span class="special">*</span> <span class="identifier">z</span></code>
|
||||
is convertible to <code class="computeroutput"><span class="identifier">Value</span></code>.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product.for_the_second_version"></a><h6>
|
||||
<a name="id3261975"></a>
|
||||
<a class="link" href="inner_product.html#range.reference.algorithms.range_numeric.inner_product.for_the_second_version">For
|
||||
the second version</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange1</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange2</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">Value</span></code> is a model of
|
||||
the <code class="computeroutput"><span class="identifier">AssignableConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BinaryOperation1</span></code> is
|
||||
a model of the <code class="computeroutput"><span class="identifier">BinaryFunctionConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BinaryOperation2</span></code> is
|
||||
a model of the <code class="computeroutput"><span class="identifier">BinaryFunctionConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The value type of <code class="computeroutput"><span class="identifier">SinglePassRange1</span></code>
|
||||
is convertible to the first argument type of <code class="computeroutput"><span class="identifier">BinaryOperation2</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The value type of <code class="computeroutput"><span class="identifier">SinglePassRange2</span></code>
|
||||
is convertible to the second argument type of <code class="computeroutput"><span class="identifier">BinaryOperation2</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">Value</span></code> is convertible
|
||||
to the value type of <code class="computeroutput"><span class="identifier">BinaryOperation1</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The return type of <code class="computeroutput"><span class="identifier">BinaryOperation2</span></code>
|
||||
is convertible to the second argument type of <code class="computeroutput"><span class="identifier">BinaryOperation1</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The return type of <code class="computeroutput"><span class="identifier">BinaryOperation1</span></code>
|
||||
is convertible to <code class="computeroutput"><span class="identifier">Value</span></code>.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product.precondition_"></a><h6>
|
||||
<a name="id3262261"></a>
|
||||
<a class="link" href="inner_product.html#range.reference.algorithms.range_numeric.inner_product.precondition_">Precondition:</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng2</span><span class="special">)</span> <span class="special">>=</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng1</span><span class="special">)</span></code> is a valid range.
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.inner_product.complexity"></a><h6>
|
||||
<a name="id3262338"></a>
|
||||
<a class="link" href="inner_product.html#range.reference.algorithms.range_numeric.inner_product.complexity">Complexity</a>
|
||||
</h6>
|
||||
<p>
|
||||
Linear. Exactly <code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng</span><span class="special">)</span></code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003 -2010 Thorsten Ottosen, Neil Groves<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="adjacent_difference.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="partial_sum.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
105
doc/html/range/reference/algorithms/range_numeric/irange.html
Normal file
105
doc/html/range/reference/algorithms/range_numeric/irange.html
Normal file
@ -0,0 +1,105 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>irange</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
|
||||
<link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0">
|
||||
<link rel="up" href="../range_numeric.html" title="Numeric algorithms">
|
||||
<link rel="prev" href="inner_product.html" title="inner_product">
|
||||
<link rel="next" href="partial_sum.html" title="partial_sum">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="inner_product.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="partial_sum.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" title="irange">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="range.reference.algorithms.range_numeric.irange"></a><a class="link" href="irange.html" title="irange">
|
||||
irange</a>
|
||||
</h5></div></div></div>
|
||||
<a name="range.reference.algorithms.range_numeric.irange.prototype"></a><h6>
|
||||
<a name="id2948790"></a>
|
||||
<a class="link" href="irange.html#range.reference.algorithms.range_numeric.irange.prototype">Prototype</a>
|
||||
</h6>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">Integer</span><span class="special">></span>
|
||||
<span class="identifier">integer_range</span><span class="special"><</span> <span class="identifier">range_detail</span><span class="special">::</span><span class="identifier">integer_iterator</span><span class="special"><</span><span class="identifier">Integer</span><span class="special">></span> <span class="special">></span>
|
||||
<span class="identifier">irange</span><span class="special">(</span><span class="identifier">Integer</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Integer</span> <span class="identifier">last</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">Integer</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">StepSize</span><span class="special">></span>
|
||||
<span class="identifier">integer_range</span><span class="special"><</span> <span class="identifier">range_detail</span><span class="special">::</span><span class="identifier">integer_iterator_with_step</span><span class="special"><</span><span class="identifier">Integer</span><span class="special">,</span> <span class="identifier">StepSize</span><span class="special">></span> <span class="special">></span>
|
||||
<span class="identifier">irange</span><span class="special">(</span><span class="identifier">Integer</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Integer</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">StepSize</span> <span class="identifier">step_size</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.irange.description"></a><h6>
|
||||
<a name="id2949086"></a>
|
||||
<a class="link" href="irange.html#range.reference.algorithms.range_numeric.irange.description">Description</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">irange</span></code> is a function
|
||||
to generate an Integer Range.
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">irange</span></code> allows treating
|
||||
integers as a model of the <a class="link" href="../../../concepts/random_access_range.html" title="Random Access Range">Random
|
||||
Access Range</a> Concept. It should be noted that the <code class="computeroutput"><span class="identifier">first</span></code> and <code class="computeroutput"><span class="identifier">last</span></code>
|
||||
parameters denoted a half-open range.
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.irange.definition"></a><h6>
|
||||
<a name="id2949168"></a>
|
||||
<a class="link" href="irange.html#range.reference.algorithms.range_numeric.irange.definition">Definition</a>
|
||||
</h6>
|
||||
<p>
|
||||
Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">irange</span><span class="special">.</span><span class="identifier">hpp</span></code>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.irange.requirements"></a><h6>
|
||||
<a name="id2949232"></a>
|
||||
<a class="link" href="irange.html#range.reference.algorithms.range_numeric.irange.requirements">Requirements</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">Integer</span></code> is a model
|
||||
of the <code class="computeroutput"><span class="identifier">Integer</span></code> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">StepSize</span></code> is a model
|
||||
of the <code class="computeroutput"><span class="identifier">SignedInteger</span></code>
|
||||
Concept.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.irange.complexity"></a><h6>
|
||||
<a name="id2949314"></a>
|
||||
<a class="link" href="irange.html#range.reference.algorithms.range_numeric.irange.complexity">Complexity</a>
|
||||
</h6>
|
||||
<p>
|
||||
Constant. Since this function generates a new range the most significant
|
||||
performance cost is incurred through the iteration of the generated range.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003 -2010 Thorsten Ottosen, Neil Groves<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="inner_product.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="partial_sum.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,161 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>partial_sum</title>
|
||||
<link rel="stylesheet" href="../../../../../../../../doc/html/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
|
||||
<link rel="home" href="../../../../index.html" title="Chapter 1. Range 2.0">
|
||||
<link rel="up" href="../range_numeric.html" title="Numeric algorithms">
|
||||
<link rel="prev" href="inner_product.html" title="inner_product">
|
||||
<link rel="next" href="../../ranges.html" title="Provided Ranges">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../../../libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="inner_product.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../ranges.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section" title="partial_sum">
|
||||
<div class="titlepage"><div><div><h5 class="title">
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum"></a><a class="link" href="partial_sum.html" title="partial_sum">
|
||||
partial_sum</a>
|
||||
</h5></div></div></div>
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum.prototype"></a><h6>
|
||||
<a name="id3262409"></a>
|
||||
<a class="link" href="partial_sum.html#range.reference.algorithms.range_numeric.partial_sum.prototype">Prototype</a>
|
||||
</h6>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">SinglePassRange</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">></span>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">partial_sum</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SinglePassRange</span><span class="special">&</span> <span class="identifier">rng</span><span class="special">,</span>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">);</span>
|
||||
|
||||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">SinglePassRange</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span>
|
||||
<span class="keyword">class</span> <span class="identifier">BinaryOperation</span><span class="special">></span>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">partial_sum</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SinglePassRange</span><span class="special">&</span> <span class="identifier">rng</span><span class="special">,</span>
|
||||
<span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">,</span>
|
||||
<span class="identifier">BinaryOperation</span> <span class="identifier">op</span><span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum.description"></a><h6>
|
||||
<a name="id3262670"></a>
|
||||
<a class="link" href="partial_sum.html#range.reference.algorithms.range_numeric.partial_sum.description">Description</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="identifier">partial_sum</span></code> calculates
|
||||
a generalised partial sum of <code class="computeroutput"><span class="identifier">rng</span></code>
|
||||
in the same manner as <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">partial_sum</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span><span class="identifier">rng</span><span class="special">),</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span><span class="identifier">rng</span><span class="special">),</span> <span class="identifier">out_it</span><span class="special">)</span></code>. See <a href="http://www.sgi.com/tech/stl/partial_sum.html" target="_top">partial_sum</a>.
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum.definition"></a><h6>
|
||||
<a name="id3262813"></a>
|
||||
<a class="link" href="partial_sum.html#range.reference.algorithms.range_numeric.partial_sum.definition">Definition</a>
|
||||
</h6>
|
||||
<p>
|
||||
Defined in the header file <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">numeric</span><span class="special">.</span><span class="identifier">hpp</span></code>
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum.requirements"></a><h6>
|
||||
<a name="id3262877"></a>
|
||||
<a class="link" href="partial_sum.html#range.reference.algorithms.range_numeric.partial_sum.requirements">Requirements</a>
|
||||
</h6>
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum.for_the_first_version"></a><h6>
|
||||
<a name="id3262900"></a>
|
||||
<a class="link" href="partial_sum.html#range.reference.algorithms.range_numeric.partial_sum.for_the_first_version">For
|
||||
the first version</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">OutputIterator</span></code> is a
|
||||
model of the <code class="computeroutput"><span class="identifier">OutputIteratorConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
If <code class="computeroutput"><span class="identifier">x</span></code> and <code class="computeroutput"><span class="identifier">y</span></code> are objects of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>'s
|
||||
value type, then <code class="computeroutput"><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span></code>
|
||||
is defined.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The return type of <code class="computeroutput"><span class="identifier">x</span> <span class="special">+</span> <span class="identifier">y</span></code>
|
||||
is convertible to the value type of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The value type of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>
|
||||
is convertible to a type in <code class="computeroutput"><span class="identifier">OutputIterator</span></code>'s
|
||||
set of value types.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum.for_the_second_version"></a><h6>
|
||||
<a name="id3263103"></a>
|
||||
<a class="link" href="partial_sum.html#range.reference.algorithms.range_numeric.partial_sum.for_the_second_version">For
|
||||
the second version</a>
|
||||
</h6>
|
||||
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">SinglePassRange</span></code> is
|
||||
a model of the <a class="link" href="../../../concepts/single_pass_range.html" title="Single Pass Range">Single
|
||||
Pass Range</a> Concept.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">OutputIterator</span></code> is a
|
||||
model of the <code class="computeroutput"><span class="identifier">OutputIteratorConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput"><span class="identifier">BinaryOperation</span></code> is
|
||||
a model of the <code class="computeroutput"><span class="identifier">BinaryFunctionConcept</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The result type of <code class="computeroutput"><span class="identifier">BinaryOperation</span></code>
|
||||
is convertible to the value type of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The value type of <code class="computeroutput"><span class="identifier">SinglePassRange</span></code>
|
||||
is convertible to a type in <code class="computeroutput"><span class="identifier">OutputIterator</span></code>'s
|
||||
set of value types.
|
||||
</li>
|
||||
</ol></div>
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum.precondition_"></a><h6>
|
||||
<a name="id3263262"></a>
|
||||
<a class="link" href="partial_sum.html#range.reference.algorithms.range_numeric.partial_sum.precondition_">Precondition:</a>
|
||||
</h6>
|
||||
<p>
|
||||
<code class="computeroutput"><span class="special">[</span><span class="identifier">result</span><span class="special">,</span> <span class="identifier">result</span>
|
||||
<span class="special">+</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng</span><span class="special">))</span></code> is a valid range.
|
||||
</p>
|
||||
<a name="range.reference.algorithms.range_numeric.partial_sum.complexity"></a><h6>
|
||||
<a name="id3263338"></a>
|
||||
<a class="link" href="partial_sum.html#range.reference.algorithms.range_numeric.partial_sum.complexity">Complexity</a>
|
||||
</h6>
|
||||
<p>
|
||||
Linear. If <code class="computeroutput"><span class="identifier">empty</span><span class="special">(</span><span class="identifier">rng</span><span class="special">)</span></code>
|
||||
then zero applications, otherwise <code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">rng</span><span class="special">)</span> <span class="special">-</span> <span class="number">1</span></code>
|
||||
applications are performed.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003 -2010 Thorsten Ottosen, Neil Groves<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="inner_product.html"><img src="../../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../range_numeric.html"><img src="../../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../../ranges.html"><img src="../../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user