2004-06-29 02:58:13 +00:00
|
|
|
<HTML>
|
|
|
|
<!--
|
|
|
|
-- Copyright (c) Jeremy Siek 2000
|
|
|
|
--
|
|
|
|
-- Permission to use, copy, modify, distribute and sell this software
|
|
|
|
-- and its documentation for any purpose is hereby granted without fee,
|
|
|
|
-- provided that the above copyright notice appears in all copies and
|
|
|
|
-- that both that copyright notice and this permission notice appear
|
|
|
|
-- in supporting documentation. Silicon Graphics makes no
|
|
|
|
-- representations about the suitability of this software for any
|
|
|
|
-- purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
-->
|
|
|
|
<Head>
|
2004-08-05 19:37:40 +00:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
|
|
<Title>Range Concepts</Title>
|
|
|
|
<link rel="stylesheet" href="style.css" type="text/css">
|
2004-06-29 02:58:13 +00:00
|
|
|
</HEAD>
|
|
|
|
|
2004-08-10 09:56:55 +00:00
|
|
|
<table border="0" >
|
|
|
|
<tr>
|
2004-10-05 15:45:52 +00:00
|
|
|
<td ><img src="../../../boost.png" border="0" ></td>
|
2004-08-10 09:56:55 +00:00
|
|
|
<td ><h1 align="center">Boost.Range </h1></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h2>Range concepts </h2>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<a href="#overview">Overview</a>
|
|
|
|
<li>
|
|
|
|
<a href="#single_pass_range">Single Pass Range</a>
|
|
|
|
<li>
|
|
|
|
<a href="#forward_range">Forward Range</a>
|
|
|
|
<li>
|
|
|
|
<a href="#bidirectional_range">Bidirectional Range</a>
|
|
|
|
<li>
|
|
|
|
<a href="#random_access_range">Random Access Range</a>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<a name="overview"></a>
|
|
|
|
<hr>
|
|
|
|
<h3>Overview</h3>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
A Range is a <i>concept</i> similar to the STL <a
|
2005-08-05 15:16:37 +00:00
|
|
|
href="http://www.sgi.com/Technology/STL/Container.html">Container</a> concept. A
|
2005-07-18 19:50:41 +00:00
|
|
|
Range provides iterators for accessing a half-open range
|
2004-08-10 09:56:55 +00:00
|
|
|
<code>[first,one_past_last)</code> of elements and provides
|
2005-08-05 15:16:37 +00:00
|
|
|
information about the number of elements in the Range. However, a Range has
|
|
|
|
fewer requirements than a Container.
|
|
|
|
</p>
|
2004-08-10 09:56:55 +00:00
|
|
|
<p>
|
2005-08-05 15:16:37 +00:00
|
|
|
The motivation for the Range concept is
|
|
|
|
that there are many useful Container-like types that do not meet the full
|
|
|
|
requirements of Container, and many algorithms that can be written with this
|
2004-08-10 09:56:55 +00:00
|
|
|
reduced set of requirements. In particular, a Range does not necessarily
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
own the elements that can be accessed through it,
|
|
|
|
<li>
|
|
|
|
have copy semantics,
|
|
|
|
<!--
|
|
|
|
<li>
|
|
|
|
require that the associated reference type is a real C++ reference.
|
|
|
|
-->
|
|
|
|
</ul>
|
|
|
|
|
2005-08-05 15:16:37 +00:00
|
|
|
|
|
|
|
Because of the second requirement, a Range object must be passed by
|
2004-08-24 15:58:01 +00:00
|
|
|
(const or non-const) reference in generic code.
|
2004-08-10 09:56:55 +00:00
|
|
|
|
|
|
|
</p>
|
|
|
|
<p>
|
2005-08-05 15:16:37 +00:00
|
|
|
The operations that can be performed on a Range is dependent on the
|
|
|
|
<a href="../../iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal">traversal
|
2004-08-10 09:56:55 +00:00
|
|
|
category</a> of the underlying iterator type. Therefore
|
2005-08-05 15:16:37 +00:00
|
|
|
the range concepts are named to reflect which traversal category its
|
2004-08-10 09:56:55 +00:00
|
|
|
iterators support. See also <a href="style.html">terminology and style guidelines.</a>
|
|
|
|
for more information about naming of ranges.</p>
|
2005-08-05 15:16:37 +00:00
|
|
|
|
2004-08-12 10:58:13 +00:00
|
|
|
<p> The concepts described below specifies associated types as
|
2005-08-05 15:16:37 +00:00
|
|
|
<a href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and all
|
2004-08-12 10:58:13 +00:00
|
|
|
functions as free-standing functions to allow for a layer of indirection. </p>
|
2004-08-10 09:56:55 +00:00
|
|
|
|
2005-08-05 15:16:37 +00:00
|
|
|
<!--<p><i>Notice that these metafunctions must be defined in namespace </i>
|
|
|
|
<code>boost</code></p>-->
|
2005-05-03 22:39:49 +00:00
|
|
|
|
2004-08-10 09:56:55 +00:00
|
|
|
<hr>
|
|
|
|
<a name="single_pass_range">
|
|
|
|
<H2>Single Pass Range</H2>
|
|
|
|
|
|
|
|
<h3>Notation</h3>
|
|
|
|
<Table>
|
2004-08-05 19:37:40 +00:00
|
|
|
<TR>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top"><code>X</code></TD>
|
|
|
|
<TD VAlign="top">A type that is a model of Single Pass Range.</TD>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top"><code>a</code></TD>
|
|
|
|
<TD VAlign="top">Object of type <code>X</code>.</TD>
|
|
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
|
2005-08-05 15:16:37 +00:00
|
|
|
|
2004-08-10 09:56:55 +00:00
|
|
|
<h3>Description</h3>
|
|
|
|
<p>
|
2005-08-05 15:16:37 +00:00
|
|
|
A range X where <code>boost::range_iterator<X>::type</code> is a model of <a
|
2004-08-10 09:56:55 +00:00
|
|
|
href="../../iterator/doc/new-iter-concepts.html#single-pass-iterators-lib-single-pass-iterators">
|
|
|
|
Single Pass Iterator</a>
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<h3>Associated types</h3>
|
|
|
|
|
|
|
|
<table border="1" cellpadding="5">
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Value type</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::range_value<X>::type</code></TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top">The type of the object stored in a Range.
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Iterator type</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::range_iterator<X>::type</code></TD>
|
|
|
|
<TD VAlign="top">The type of iterator used to iterate through a Range's elements.
|
|
|
|
The iterator's value type is expected to be the Range's value type. A
|
2004-08-10 09:56:55 +00:00
|
|
|
conversion from the iterator type to the const iterator type must exist.
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Const iterator type</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::range_const_iterator<X>::type</code></TD>
|
|
|
|
<TD VAlign="top">A type of iterator that may be used to examine, but not to
|
2004-08-10 09:56:55 +00:00
|
|
|
modify, a Range's elements.</TD>
|
|
|
|
</TR>
|
|
|
|
<!--
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Reference type</TD>
|
|
|
|
<TD VAlign="top"><code>reference_of<X>::type</code></TD>
|
|
|
|
<TD VAlign="top">A type that behaves like a reference to the Range's value type. <a href="#1">[1]</a></TD>
|
|
|
|
</TR>
|
|
|
|
-->
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<h3>Valid expressions</h3>
|
|
|
|
|
|
|
|
The following expressions must be valid.
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<Table border="1" cellpadding="5">
|
|
|
|
<TR>
|
|
|
|
<TH>Name</TH>
|
|
|
|
<TH>Expression</TH>
|
|
|
|
<TH>Return type</TH>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Beginning of range</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::begin(a)</code></TD>
|
|
|
|
<TD VAlign="top"><code>boost::range_iterator<X>::type</code> if
|
|
|
|
<code>a</code> is mutable, <code>boost::range_const_iterator<X>::type</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
otherwise</TD> </TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">End of range</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::end(a)</code></TD>
|
|
|
|
<TD VAlign="top"><code>boost::range_iterator<X>::type</code> if
|
|
|
|
<code>a</code> is mutable, <code>boost::range_const_iterator<X>::type</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
otherwise</TD>
|
|
|
|
</TR>
|
|
|
|
<tr>
|
|
|
|
<TD VAlign="top">Is range empty?</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::empty(a)</code></TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top">Convertible to <code>bool</code></TD>
|
|
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
<h3>Expression semantics</h3>
|
|
|
|
|
|
|
|
<Table border>
|
|
|
|
<TR>
|
|
|
|
<TH>Expression</TH>
|
|
|
|
<TH>Semantics</TH>
|
|
|
|
<TH>Postcondition</TH>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::begin(a)</code></TD>
|
2004-08-05 19:37:40 +00:00
|
|
|
<TD VAlign="top">Returns an iterator pointing to the first element in the Range.</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::begin(a)</code> is either dereferenceable or past-the-end.
|
|
|
|
It is past-the-end if and only if <code>boost::size(a) == 0</code>.</TD>
|
2004-08-05 19:37:40 +00:00
|
|
|
</TR>
|
|
|
|
<TR>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::end(a)</code></TD>
|
2004-08-05 19:37:40 +00:00
|
|
|
<TD VAlign="top">Returns an iterator pointing one past the last element in the
|
|
|
|
Range.</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::end(a)</code> is past-the-end.</TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
</TR>
|
|
|
|
<TR>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::empty(a)</code></TD>
|
|
|
|
<TD VAlign="top">Equivalent to <code>boost::begin(a) == boost::end(a)</code>. (But possibly
|
2004-08-10 09:56:55 +00:00
|
|
|
faster.)</TD>
|
|
|
|
<TD VAlign="top"> - </TD>
|
|
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Complexity guarantees</h3>
|
|
|
|
|
|
|
|
All three functions are at most amortized linear time. For most practical
|
2005-08-05 15:16:37 +00:00
|
|
|
purposes, one can expect <code>boost::begin(a)</code>, <code>boost::end(a)</code> and <code>boost::empty(a)</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
to be amortized constant time.
|
|
|
|
|
|
|
|
<h3>Invariants</h3>
|
|
|
|
<Table border>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Valid range</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top">For any Range <code>a</code>, <code>[boost::begin(a),boost::end(a))</code> is
|
|
|
|
a valid range, that is, <code>boost::end(a)</code> is reachable from <code>boost::begin(a)</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
in a finite number of increments.</TD>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Completeness</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top">An algorithm that iterates through the range <code>[boost::begin(a),boost::end(a))</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
will pass through every element of <code>a</code>.</TD>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<h3>See also</h3>
|
|
|
|
<p>
|
|
|
|
<A href="http://www.sgi.com/Technology/STL/Container.html">Container</A>
|
|
|
|
</p>
|
2005-08-05 15:16:37 +00:00
|
|
|
<p> <a href="boost_range.html#boost::range_value">implementation of
|
2005-05-03 22:39:49 +00:00
|
|
|
metafunctions </a></p>
|
|
|
|
|
|
|
|
<p> <a href="boost_range.html#begin">implementation of
|
|
|
|
functions </a></p>
|
2004-08-10 09:56:55 +00:00
|
|
|
|
|
|
|
<hr>
|
|
|
|
<a name=forward_range><h2>Forward Range</h2>
|
|
|
|
|
|
|
|
<h3>Notation</h3>
|
|
|
|
<Table>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top"><code>X</code></TD>
|
|
|
|
<TD VAlign="top">A type that is a model of Forward Range.</TD>
|
2004-08-05 19:37:40 +00:00
|
|
|
</TR>
|
|
|
|
<TR>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top"><code>a</code></TD>
|
|
|
|
<TD VAlign="top">Object of type <code>X</code>.</TD>
|
|
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Description</h3>
|
|
|
|
<p>
|
2005-08-05 15:16:37 +00:00
|
|
|
A range <code>X</code> where <code>boost::range_iterator<X>::type</code> is a model
|
2004-08-10 09:56:55 +00:00
|
|
|
of <a
|
|
|
|
href="../../iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators">Forward Traversal Iterator</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3>Refinement of</h3> <a href="#single_pass_range">Single Pass
|
|
|
|
Range</a>
|
|
|
|
|
|
|
|
<h3>Associated types</h3>
|
|
|
|
|
|
|
|
<table cellpadding="5" border="1">
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Distance type</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::range_difference<X>::type</code></TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top">A signed integral type used to represent the distance between
|
|
|
|
two of the Range's iterators. This type must be the same as the iterator's
|
|
|
|
distance type.</TD>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Size type</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::range_size<X>::type</code></TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top">An unsigned integral type that can represent any nonnegative
|
|
|
|
value of the Range's distance type.</TD>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Valid expressions</h3>
|
|
|
|
|
|
|
|
<table border="1" cellpadding="5">
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Expression</th>
|
|
|
|
<th>Return type</th>
|
|
|
|
</tr>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Size of range</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::size(a)</code></TD>
|
|
|
|
<TD VAlign="top"><code>boost::range_size<X>::type</code></TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Expression semantics </h3>
|
|
|
|
|
|
|
|
<table border="1" cellpadding="5">
|
|
|
|
<TR>
|
|
|
|
<TH>Expression</TH>
|
|
|
|
<TH>Semantics</TH>
|
|
|
|
<TH>Postcondition</TH>
|
|
|
|
</TR>
|
|
|
|
<tr>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::size(a)</code></TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top">Returns the size of the Range, that is, its number
|
2005-08-05 15:16:37 +00:00
|
|
|
of elements. Note <code>boost::size(a) == 0u</code> is equivalent to
|
|
|
|
<code>boost::empty(a).</code></TD>
|
|
|
|
<TD VAlign="top"><code>boost::size(a) >= 0</TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Complexity guarantees</h3>
|
|
|
|
|
2005-08-05 15:16:37 +00:00
|
|
|
<p><code>boost::size(a)</code> is at most amortized linear time.</p>
|
2004-08-10 09:56:55 +00:00
|
|
|
|
|
|
|
<h3>Invariants</h3>
|
|
|
|
<p>
|
|
|
|
<Table border="1" cellpadding="5">
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Range size</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::size(a)</code> is equal to the distance from <code>boost::begin(a)</code>
|
|
|
|
to <code>boost::end(a)</code>.</TD> </table>
|
2004-08-10 09:56:55 +00:00
|
|
|
</p>
|
2005-05-03 22:39:49 +00:00
|
|
|
|
|
|
|
<h3>See also</h3>
|
2005-08-05 15:16:37 +00:00
|
|
|
<p> <a href="boost_range.html#boost::range_difference">implementation of
|
2005-05-03 22:39:49 +00:00
|
|
|
metafunctions </a></p>
|
|
|
|
|
|
|
|
<p> <a href="boost_range.html#size">implementation of
|
|
|
|
functions </a></p>
|
|
|
|
|
2004-08-10 09:56:55 +00:00
|
|
|
<hr>
|
|
|
|
|
2005-05-03 22:39:49 +00:00
|
|
|
<a name="bidirectional_range"><h2>Bidirectional Range</h2>
|
2004-08-10 09:56:55 +00:00
|
|
|
|
|
|
|
<h3>Notation</h3>
|
|
|
|
<Table>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top"><code>X</code></TD>
|
|
|
|
<TD VAlign="top">A type that is a model of Bidirectional Range.</TD>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top"><code>a</code></TD>
|
|
|
|
<TD VAlign="top">Object of type <code>X</code>.</TD>
|
|
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Description</h3> This concept provides access to iterators that traverse in
|
|
|
|
both directions (forward and reverse). The
|
2005-08-05 15:16:37 +00:00
|
|
|
<code>boost::range_iterator<X>::type</code> iterator must meet all of the requirements
|
2004-08-10 09:56:55 +00:00
|
|
|
of <a
|
|
|
|
href="../../iterator/doc/new-iter-concepts.html#bidirectional-traversal-iterator
|
|
|
|
s-lib-bidirectional-traversal-iterators">Bidirectional Traversal Iterator.</a>
|
|
|
|
|
|
|
|
<h3>Refinement of</h3> <a href="#forward_range">Forward Range</a>
|
|
|
|
|
|
|
|
<h3>Associated types</h3>
|
|
|
|
|
|
|
|
<Table border>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Reverse Iterator type</TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::range_reverse_iterator<X>::type</code></TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top">The type of iterator used to iterate through a Range's elements
|
|
|
|
in reverse order. The iterator's value type is expected to be the Range's value
|
|
|
|
type. A conversion from the reverse iterator type to the const reverse iterator
|
|
|
|
type must exist. </TD>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Const reverse iterator type</TD>
|
|
|
|
<TD
|
2005-08-05 15:16:37 +00:00
|
|
|
VAlign="top"><code>boost::range_const_reverse_iterator<X>::type</code></TD>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top">A type of reverse iterator that may be used to examine, but not
|
|
|
|
to modify, a Range's elements.</TD>
|
|
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<h3>Valid expressions</h3>
|
|
|
|
|
|
|
|
<Table border>
|
|
|
|
<TR>
|
|
|
|
<TH>Name</TH>
|
|
|
|
<TH>Expression</TH>
|
|
|
|
<TH>Return type</TH>
|
|
|
|
<TH>Semantics</TH>
|
|
|
|
</TR>
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Beginning of range</TD>
|
2005-09-07 16:12:03 +00:00
|
|
|
<TD VAlign="top"><code>boost::rbegin(a)</code></TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::range_reverse_iterator<X>::type</code> if
|
|
|
|
<code>a</code> is mutable, <code>boost::range_const_reverse_iterator<X>::type</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
otherwise.</TD>
|
|
|
|
<TD VAlign="top">Equivalent to
|
2005-08-05 15:16:37 +00:00
|
|
|
<code>boost::range_reverse_iterator<X>::type(boost::end(a))</code>.</TD> </TR>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">End of range</TD>
|
2005-09-07 16:12:03 +00:00
|
|
|
<TD VAlign="top"><code>boost::rend(a)</code></TD>
|
2005-08-05 15:16:37 +00:00
|
|
|
<TD VAlign="top"><code>boost::range_reverse_iterator<X>::type</code> if
|
|
|
|
<code>a</code> is mutable, <code>boost::range_const_reverse_iterator<X>::type</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
otherwise.</TD>
|
|
|
|
<TD VAlign="top">Equivalent to
|
2005-08-05 15:16:37 +00:00
|
|
|
<code>boost::range_reverse_iterator<X>::type(boost::begin(a))</code>.</TD> </tr>
|
2004-08-10 09:56:55 +00:00
|
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>Complexity guarantees</h3>
|
|
|
|
|
2005-09-07 16:12:03 +00:00
|
|
|
<code>boost::rbegin(a)</code> has the same complexity as <code>boost::end(a)</code> and <code>boost::rend(a)</code>
|
2005-08-05 15:16:37 +00:00
|
|
|
has the same complexity as <code>boost::begin(a)</code> from <a
|
2004-08-10 09:56:55 +00:00
|
|
|
href="#forward_range">Forward Range</a>.
|
|
|
|
|
|
|
|
<h3>Invariants</h3>
|
|
|
|
<p>
|
|
|
|
<Table border="1" cellpadding="5">
|
|
|
|
<TR>
|
|
|
|
<TD VAlign="top">Valid reverse range</TD>
|
2005-09-07 16:12:03 +00:00
|
|
|
<TD VAlign="top">For any Bidirectional Range <code>a</code>, <code>[boost::rbegin(a),boost::rend(a))</code>
|
|
|
|
is a valid range, that is, <code>boost::rend(a)</code> is reachable from <code>boost::rbegin(a)</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
in a finite number of increments.</TD>
|
2004-08-05 19:37:40 +00:00
|
|
|
</TR>
|
|
|
|
<TR>
|
2004-08-10 09:56:55 +00:00
|
|
|
<TD VAlign="top">Completeness</TD>
|
2005-09-07 16:12:03 +00:00
|
|
|
<TD VAlign="top">An algorithm that iterates through the range <code>[boost::rbegin(a),boost::rend(a))</code>
|
2004-08-10 09:56:55 +00:00
|
|
|
will pass through every element of <code>a</code>.</TD>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</p>
|
2005-05-03 22:39:49 +00:00
|
|
|
|
|
|
|
<h3>See also</h3>
|
2005-08-05 15:16:37 +00:00
|
|
|
<p> <a href="boost_range.html#boost::range_reverse_iterator">implementation of metafunctions </a></p>
|
2005-05-03 22:39:49 +00:00
|
|
|
|
|
|
|
<p> <a href="boost_range.html#rbegin">implementation of
|
|
|
|
functions </a></p>
|
|
|
|
|
2004-08-10 09:56:55 +00:00
|
|
|
<hr>
|
|
|
|
|
|
|
|
<a name=random_access_range><h2>Random Access Range</h2> <h3>Description</h3>
|
|
|
|
<p>
|
2005-08-05 15:16:37 +00:00
|
|
|
A range <code>X</code> where <code>boost::range_iterator<X>::type</code> is a model
|
2004-08-10 09:56:55 +00:00
|
|
|
of <a
|
2004-10-06 18:19:13 +00:00
|
|
|
|
|
|
|
href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterators
|
2004-08-10 09:56:55 +00:00
|
|
|
-lib-random-access-traversal-iterators">Random Access Traversal Iterator</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<h3>Refinement of</h3>
|
|
|
|
<p>
|
|
|
|
<a href="#bidirectional_range">Bidirectional Range</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
<h3>Notes</h3>
|
|
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<A name="1">[1]</A>
|
|
|
|
|
|
|
|
The reference type does not have to be a real C++ reference. The requirements of
|
|
|
|
the reference type is that it <i>behaves</i> like a real reference. Hence the
|
|
|
|
reference type must be convertible to the value_type and assignment through
|
|
|
|
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<HR>
|
|
|
|
<br>
|
|
|
|
-->
|
|
|
|
|
|
|
|
<TABLE>
|
|
|
|
<TR valign="top">
|
|
|
|
<TD nowrap>Copyright © 2000</TD>
|
|
|
|
<TD><A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A>
|
2004-08-05 19:37:40 +00:00
|
|
|
</TR>
|
2004-08-10 09:56:55 +00:00
|
|
|
<tr >
|
|
|
|
<TD nowrap>Copyright © 2004</TD>
|
|
|
|
<TD>Thorsten Ottosen.
|
|
|
|
</TABLE>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
</BODY>
|
2004-08-05 19:37:40 +00:00
|
|
|
</HTML>
|