blob: bded544c579699bd3d94903ed358568766462190 [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Overview</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&#160;1.&#160;Range 2.0">
<link rel="up" href="../concepts.html" title="Range Concepts">
<link rel="prev" href="../concepts.html" title="Range Concepts">
<link rel="next" href="single_pass_range.html" title="Single Pass Range">
</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="../concepts.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.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="single_pass_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="range.concepts.overview"></a><a class="link" href="overview.html" title="Overview">Overview</a>
</h3></div></div></div>
<p>
A Range is a <span class="bold"><strong><span class="emphasis"><em>concept</em></span></strong></span>
similar to the STL <a href="http://www.sgi.com/Technology/STL/Container.html" target="_top">Container</a>
concept. A Range provides iterators for accessing a half-open range <code class="computeroutput"><span class="special">[</span><span class="identifier">first</span><span class="special">,</span><span class="identifier">one_past_last</span><span class="special">)</span></code> of elements and provides information about
the number of elements in the Range. However, a Range has fewer requirements
than a Container.
</p>
<p>
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 reduced set of requirements. In particular,
a Range does not necessarily
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
own the elements that can be accessed through it,
</li>
<li class="listitem">
have copy semantics,
</li>
</ul></div>
<p>
Because of the second requirement, a Range object must be passed by (const
or non-const) reference in generic code.
</p>
<p>
The operations that can be performed on a Range is dependent on the <a href="../../../../../../libs/iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal" target="_top">traversal
category</a> of the underlying iterator type. Therefore the range concepts
are named to reflect which traversal category its iterators support. See
also terminology and style guidelines. for more information about naming
of ranges.
</p>
<p>
The concepts described below specifies associated types as <a href="../../../../../../libs/mpl/doc/refmanual/metafunction.html" target="_top">metafunctions</a>
and all functions as free-standing functions to allow for a layer of indirection.
</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 &#169; 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="../concepts.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.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="single_pass_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>