mirror of
https://github.com/boostorg/range.git
synced 2026-01-24 07:52:22 +01:00
142 lines
9.9 KiB
HTML
142 lines
9.9 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>General Requirements</title>
|
|
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
|
<link rel="home" href="../../../index.html" title="Chapter 1. Range 2.0">
|
|
<link rel="up" href="../adaptors.html" title="Range Adaptors">
|
|
<link rel="prev" href="introduction.html" title="Introduction and motivation">
|
|
<link rel="next" href="reference.html" title="Reference">
|
|
</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="../../../../../../../libs/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="introduction.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../adaptors.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h4 class="title">
|
|
<a name="range.reference.adaptors.general_requirements"></a><a class="link" href="general_requirements.html" title="General Requirements"> General
|
|
Requirements</a>
|
|
</h4></div></div></div>
|
|
<p>
|
|
In the description of generator expressions, the following notation is
|
|
used:
|
|
</p>
|
|
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="identifier">fwdRng</span></code> is an expression
|
|
of a type <code class="computeroutput"><span class="identifier">R</span></code> that models
|
|
<code class="computeroutput"><span class="identifier">ForwardRange</span></code>
|
|
</li>
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="identifier">biRng</span></code> is an expression
|
|
of a type <code class="computeroutput"><span class="identifier">R</span></code> that models
|
|
<code class="computeroutput"><span class="identifier">BidirectionalRange</span></code>
|
|
</li>
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="identifier">rndRng</span></code> is an expression
|
|
of a type <code class="computeroutput"><span class="identifier">R</span></code> that models
|
|
<code class="computeroutput"><span class="identifier">RandomAccessRange</span></code>
|
|
</li>
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="identifier">pred</span></code> is an expression
|
|
of a type that models <code class="computeroutput"><span class="identifier">UnaryPredicate</span></code>
|
|
</li>
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="identifier">bi_pred</span></code> is an expression
|
|
of a type that models <code class="computeroutput"><span class="identifier">BinaryPredicate</span></code>
|
|
</li>
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="identifier">fun</span></code> is an expression
|
|
of a type that models <code class="computeroutput"><span class="identifier">UnaryFunction</span></code>
|
|
</li>
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="identifier">value</span></code>, <code class="computeroutput"><span class="identifier">new_value</span></code> and <code class="computeroutput"><span class="identifier">old_value</span></code>
|
|
are objects convertible to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_value</span><span class="special"><</span><span class="identifier">R</span><span class="special">>::</span><span class="identifier">type</span></code>
|
|
</li>
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="identifier">n</span><span class="special">,</span><span class="identifier">m</span></code> are integer expressions convertible
|
|
to <code class="computeroutput"><span class="identifier">range_difference</span><span class="special"><</span><span class="identifier">R</span><span class="special">>::</span><span class="identifier">type</span></code>
|
|
</li>
|
|
</ul></div>
|
|
<p>
|
|
Also note that <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_value</span><span class="special"><</span><span class="identifier">R</span><span class="special">>::</span><span class="identifier">type</span></code> must be implicitly convertible to
|
|
the type arguments to <code class="computeroutput"><span class="identifier">pred</span></code>,
|
|
<code class="computeroutput"><span class="identifier">bi_pred</span></code> and <code class="computeroutput"><span class="identifier">fun</span></code>.
|
|
</p>
|
|
<p>
|
|
Range Category in the following adaptor descriptions refers to the minimum
|
|
range concept required by the range passed to the adaptor. The resultant
|
|
range is a model of the same range concept as the input range unless specified
|
|
otherwise.
|
|
</p>
|
|
<p>
|
|
Returned Range Category is the concept of the returned range. In some cases
|
|
the returned range is of a lesser category than the range passed to the
|
|
adaptor. For example, the <code class="computeroutput"><span class="identifier">filtered</span></code>
|
|
adaptor returns only a <code class="computeroutput"><span class="identifier">ForwardRange</span></code>
|
|
regardless of the input.
|
|
</p>
|
|
<p>
|
|
Furthermore, the following rules apply to any expression of the form
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">rng</span> <span class="special">|</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">adaptors</span><span class="special">::</span><span class="identifier">adaptor_generator</span>
|
|
</pre>
|
|
<p>
|
|
</p>
|
|
<p>
|
|
1. Applying <code class="computeroutput"><span class="keyword">operator</span><span class="special">|()</span></code>
|
|
to a range <code class="computeroutput"><span class="identifier">R</span></code> (always left
|
|
argument) and a range adapter <code class="computeroutput"><span class="identifier">RA</span></code>
|
|
(always right argument) yields a new range type which may not conform to
|
|
the same range concept as <code class="computeroutput"><span class="identifier">R</span></code>.
|
|
</p>
|
|
<p>
|
|
2. The return-type of <code class="computeroutput"><span class="keyword">operator</span><span class="special">|()</span></code> is otherwise unspecified.
|
|
</p>
|
|
<p>
|
|
3. <code class="computeroutput"><span class="keyword">operator</span><span class="special">|()</span></code>
|
|
is found by Argument Dependent Lookup (ADL) because a range adaptor is
|
|
implemented in namespace <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">adaptors</span></code>.
|
|
</p>
|
|
<p>
|
|
4. <code class="computeroutput"><span class="keyword">operator</span><span class="special">|()</span></code>
|
|
is used to add new behaviour <span class="emphasis"><em><span class="bold"><strong>lazily</strong></span></em></span>
|
|
and never modifies its left argument.
|
|
</p>
|
|
<p>
|
|
5. All iterators extracted from the left argument are extracted using qualified
|
|
calls to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">()</span></code>
|
|
and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">()</span></code>.
|
|
</p>
|
|
<p>
|
|
6. In addition to the <code class="computeroutput"><span class="keyword">throw</span></code>-clauses
|
|
below, <code class="computeroutput"><span class="keyword">operator</span><span class="special">|()</span></code>
|
|
may throw exceptions as a result of copying iterators. If such copying
|
|
cannot throw an exception, then neither can the whole expression.
|
|
</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="introduction.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../adaptors.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="reference.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|