6f63e9d0c6
[SVN r64705]
138 lines
10 KiB
HTML
138 lines
10 KiB
HTML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
|
|
<title>The MPL Reference Manual: Forward Sequence</title>
|
|
<link rel="stylesheet" href="../style.css" type="text/css" />
|
|
</head>
|
|
<body class="docframe refmanual">
|
|
<table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./concepts.html" class="navigation-link">Prev</a> <a href="./bidirectional-sequence.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group">Back <a href="./bidirectional-sequence.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./concepts.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
|
|
<td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./sequences.html" class="navigation-link">Sequences</a> / <a href="./concepts.html" class="navigation-link">Concepts</a> / <a href="./forward-sequence.html" class="navigation-link">Forward Sequence</a></td>
|
|
</tr></table><div class="header-separator"></div>
|
|
<div class="section" id="forward-sequence">
|
|
<h1><a class="toc-backref" href="./concepts.html#id1395">Forward Sequence</a></h1>
|
|
<div class="section" id="description">
|
|
<h3>Description</h3>
|
|
<p>A <a class="reference internal" href="./forward-sequence.html">Forward Sequence</a> is an MPL concept representing a compile-time sequence of
|
|
elements. Sequence elements are
|
|
types, and are accessible through <a class="reference internal" href="./iterators.html">Iterators</a>. The <a class="reference internal" href="./begin.html">begin</a> and <a class="reference internal" href="./end.html">end</a> metafunctions
|
|
provide iterators delimiting the range of the sequence
|
|
elements. A sequence guarantees that its elements are arranged in a definite,
|
|
but possibly unspecified, order. Every MPL sequence is a <a class="reference internal" href="./forward-sequence.html">Forward Sequence</a>.</p>
|
|
</div>
|
|
<div class="section" id="definitions">
|
|
<h3>Definitions</h3>
|
|
<ul class="simple">
|
|
<li>The <em>size</em> of a sequence is the number of elements it contains. The size is a
|
|
nonnegative number.</li>
|
|
<li>A sequence is <em>empty</em> if its size is zero.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section" id="expression-requirements">
|
|
<h3>Expression requirements</h3>
|
|
<p>For any <a class="reference internal" href="./forward-sequence.html">Forward Sequence</a> <tt class="literal"><span class="pre">s</span></tt> the following expressions must be valid:</p>
|
|
<table border="1" class="docutils table">
|
|
<colgroup>
|
|
<col width="30%" />
|
|
<col width="39%" />
|
|
<col width="30%" />
|
|
</colgroup>
|
|
<thead valign="bottom">
|
|
<tr><th class="head">Expression</th>
|
|
<th class="head">Type</th>
|
|
<th class="head">Complexity</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody valign="top">
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><s>::type</span></tt></td>
|
|
<td><a class="reference internal" href="./forward-iterator.html">Forward Iterator</a></td>
|
|
<td>Amortized constant time</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><s>::type</span></tt></td>
|
|
<td><a class="reference internal" href="./forward-iterator.html">Forward Iterator</a></td>
|
|
<td>Amortized constant time</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a><s>::type</span></tt></td>
|
|
<td><a class="reference internal" href="./integral-constant.html">Integral Constant</a></td>
|
|
<td>Unspecified</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./empty.html" class="identifier">empty</a><s>::type</span></tt></td>
|
|
<td>Boolean <a class="reference internal" href="./integral-constant.html">Integral Constant</a></td>
|
|
<td>Constant time</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./front.html" class="identifier">front</a><s>::type</span></tt></td>
|
|
<td>Any type</td>
|
|
<td>Amortized constant time</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="expression-semantics">
|
|
<h3>Expression semantics</h3>
|
|
<table border="1" class="docutils table">
|
|
<colgroup>
|
|
<col width="28%" />
|
|
<col width="72%" />
|
|
</colgroup>
|
|
<thead valign="bottom">
|
|
<tr><th class="head">Expression</th>
|
|
<th class="head">Semantics</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody valign="top">
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><s>::type</span></tt></td>
|
|
<td>An iterator to the first element of the sequence; see <a class="reference internal" href="./begin.html">begin</a>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><s>::type</span></tt></td>
|
|
<td>A past-the-end iterator to the sequence; see <a class="reference internal" href="./end.html">end</a>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a><s>::type</span></tt></td>
|
|
<td>The size of the sequence; see <a class="reference internal" href="./size.html">size</a>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./empty.html" class="identifier">empty</a><s>::type</span></tt></td>
|
|
<td>A boolean <a class="reference internal" href="./integral-constant.html">Integral Constant</a> <tt class="literal"><span class="pre">c</span></tt> such that
|
|
<tt class="literal"><span class="pre">c::value</span> <span class="pre">==</span> <span class="pre">true</span></tt> if and only if the sequence is empty; see <a class="reference internal" href="./empty.html">empty</a>.</td>
|
|
</tr>
|
|
<tr><td><tt class="literal"><span class="pre"><a href="./front.html" class="identifier">front</a><s>::type</span></tt></td>
|
|
<td>The first element in the sequence; see <a class="reference internal" href="./front.html">front</a>.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="invariants">
|
|
<h3>Invariants</h3>
|
|
<p>For any <a class="reference internal" href="./forward-sequence.html">Forward Sequence</a> <tt class="literal"><span class="pre">s</span></tt> the following invariants always hold:</p>
|
|
<ul class="simple">
|
|
<li>[<tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><s>::type</span></tt>, <tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><s>::type</span></tt>) is always a valid range.</li>
|
|
<li>An algorithm that iterates through the range [<tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><s>::type</span></tt>, <tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><s>::type</span></tt>)
|
|
will pass through every element of <tt class="literal"><span class="pre">s</span></tt> exactly once.</li>
|
|
<li><tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a><s>::type</span></tt> is identical to <tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a><s>::type</span></tt> if and only if <tt class="literal"><span class="pre">s</span></tt> is empty.</li>
|
|
<li>Two different iterations through <tt class="literal"><span class="pre">s</span></tt> will access its elements in the same order.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section" id="models">
|
|
<h3>Models</h3>
|
|
<ul class="simple">
|
|
<li><a class="reference internal" href="./vector.html">vector</a></li>
|
|
<li><a class="reference internal" href="./map.html">map</a></li>
|
|
<li><a class="reference internal" href="./range-c.html">range_c</a></li>
|
|
<li><a class="reference internal" href="./iterator-range.html">iterator_range</a></li>
|
|
<li><a class="reference internal" href="./filter-view.html">filter_view</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="section" id="see-also">
|
|
<h3>See also</h3>
|
|
<p><a class="reference internal" href="./sequences.html">Sequences</a>, <a class="reference internal" href="./bidirectional-sequence.html">Bidirectional Sequence</a>, <a class="reference internal" href="./forward-iterator.html">Forward Iterator</a>, <a class="reference internal" href="./begin.html">begin</a> / <a class="reference internal" href="./end.html">end</a>, <a class="reference internal" href="./size.html">size</a>, <a class="reference internal" href="./empty.html">empty</a>, <a class="reference internal" href="./front.html">front</a></p>
|
|
<!-- Sequences/Concepts//Bidirectional Sequence |20 -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="footer-separator"></div>
|
|
<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./concepts.html" class="navigation-link">Prev</a> <a href="./bidirectional-sequence.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group">Back <a href="./bidirectional-sequence.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./concepts.html" class="navigation-link">Up</a> <a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
|
|
<td><div class="copyright-footer"><div class="copyright">Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams</div>
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</div></td></tr></table></body>
|
|
</html>
|