mirror of
https://github.com/boostorg/mpl.git
synced 2026-01-26 17:02:20 +01:00
64 lines
2.5 KiB
HTML
64 lines
2.5 KiB
HTML
<!doctype html public "-//ietf//dtd html//en">
|
|
<html><head><title>boost::mpl::back</title>
|
|
<link rel="stylesheet" href="../mpl_wiki.css">
|
|
</head><body bgcolor="white">
|
|
<h1><a href="../Table_of_Contents.html"><img src="../mpl_logo.jpg" alt="[Home]" border=0 align="right"></a>back</h1><h3>Synopsis</h3>
|
|
<p>
|
|
<pre>
|
|
template<
|
|
typename Sequence
|
|
>
|
|
struct back
|
|
{
|
|
typedef <em>unspecified</em> type;
|
|
};
|
|
</pre>
|
|
<p>
|
|
<h3>Description</h3>
|
|
<p>
|
|
Returns a type identical to the last element in the sequence, that is, the element in a position that preceeds the position of past-the-end iterator.
|
|
<p>
|
|
<h3>Definition</h3>
|
|
<p>
|
|
<pre>
|
|
#include "<a href="../../../../../boost/mpl/back.hpp">boost/mpl/back.hpp</a>"
|
|
</pre>
|
|
<p>
|
|
<h3>Parameters</h3>
|
|
<table border="1">
|
|
<tr><th> Parameter </th><th> Requirement </th><th> Description </th></tr>
|
|
<tr><td><code>Sequence</code></td><td>A model of <a href="../Forward_Sequence.html">Forward Sequence</a></td><td>A sequence to be examined. </td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Expression semantics</h3>
|
|
<p>
|
|
<table border="1">
|
|
<tr><th> Expression </th><th> Expression type </th><th> Precondition </th><th> Semantics </th><th> Postcondition </th></tr>
|
|
<tr><td><code>typedef back<Sequence>::type t;</code></td><td>A type</td><td><code>empty<Sequence>::type::value == false</code></td><td>Equivalent to <code>typedef prior< end<Sequence>::type >::type::type t;</code></td><td></td></tr>
|
|
</table>
|
|
<p>
|
|
<h3>Complexity</h3>
|
|
<p>
|
|
Amortized constant time [<a href="#1">1</a>].
|
|
<p>
|
|
<h3>Example</h3>
|
|
<p>
|
|
<pre>
|
|
typedef <a href="../Reference/range_c.html">range_c</a><int,0,1> range1;
|
|
typedef range_c<int,0,10> range2;
|
|
typedef range_c<int,-10,0> range3;
|
|
<p>
|
|
BOOST_STATIC_ASSERT(back<range1>::type::value == 0);
|
|
BOOST_STATIC_ASSERT(back<range2>::type::value == 9);
|
|
BOOST_STATIC_ASSERT(back<range3>::type::value == -1);
|
|
</pre>
|
|
<p>
|
|
<h3>Notes</h3>
|
|
<p>
|
|
[<a name="1">1</a>] The algorithm is provided only if the sequence can meet the stated complexity requirements.<br>
|
|
<p>
|
|
<h3>See also</h3>
|
|
<p>
|
|
<a href="../Forward_Sequence.html">Forward Sequence</a>, <code><a href="../Reference/front.html">front</a></code>, <code><a href="../Reference/at.html">at</a></code>, <code><a href="../Reference/end.html">end</a></code>, <code><a href="../Reference/push_back.html">push_back</a></code>
|
|
<p><hr>
|
|
<a href="../Table_of_Contents.html">Table of Contents</a><br>Last edited July 17, 2002 3:47 am</body></html> |