mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-01 05:44:37 +02:00
Merge pull request #2 from danieljames/develop-cherry-pick
Cherry pick old changes from master, and a small whitespace fix.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<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="./classes.html" class="navigation-link">Classes</a> / <a href="./set.html" class="navigation-link">set</a></td>
|
||||
</tr></table><div class="header-separator"></div>
|
||||
<div class="section" id="set">
|
||||
<h1><a class="toc-backref" href="./classes.html#id1409">set</a></h1>
|
||||
<h1><a class="toc-backref" href="./classes.html#id1410">set</a></h1>
|
||||
<div class="section" id="id72">
|
||||
<h3><a class="subsection-title" href="#description" name="description">Description</a></h3>
|
||||
<p><tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> is a <a class="reference internal" href="./variadic-sequence.html">variadic</a>, <a class="reference internal" href="./associative-sequence.html">associative</a>, <a class="reference internal" href="./extensible-associative-sequence.html">extensible</a> sequence of types that
|
||||
@@ -52,7 +52,8 @@ A <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">
|
||||
<div class="section" id="id77">
|
||||
<h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3>
|
||||
<p>In the following table, <tt class="literal"><span class="pre">s</span></tt> is an instance of <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt>, <tt class="literal"><span class="pre">pos</span></tt> is an iterator into <tt class="literal"><span class="pre">s</span></tt>,
|
||||
and <tt class="literal"><span class="pre">x</span></tt>, <tt class="literal"><span class="pre">k</span></tt>, and <em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub> are arbitrary types.</p>
|
||||
and <tt class="literal"><span class="pre">x</span></tt>, <tt class="literal"><span class="pre">k</span></tt>, and <em>t</em><sub>1</sub>,<em>t</em><sub>2</sub>,... <em>t</em><sub>n</sub> is a set of <em>unique</em> arbitrary types. [<em>Note:</em> See <a class="reference internal" href="./set.html#nonunique-set-example">below</a> for
|
||||
an example of how to construct a <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> from a list of potentially non-unique types — <em>end note</em>]</p>
|
||||
<table border="1" class="docutils table">
|
||||
<colgroup>
|
||||
<col width="40%" />
|
||||
@@ -151,8 +152,9 @@ the key <tt class="literal"><span class="pre">k</span></tt> in <tt class="litera
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section" id="id78">
|
||||
<div class="section" id="id79">
|
||||
<h3><a class="subsection-title" href="#example" name="example">Example</a></h3>
|
||||
<p>Basic <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> invariants:</p>
|
||||
<pre class="literal-block">
|
||||
typedef <a href="./set.html" class="identifier">set</a>< int,long,double,<a href="./int.html" class="identifier">int_</a><5> > s;
|
||||
|
||||
@@ -164,8 +166,18 @@ typedef <a href="./set.html" class="identifier">set</a>< int,long,double,<a h
|
||||
<a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< <a href="./at.html" class="identifier">at</a><s,<a href="./int.html" class="identifier">int_</a><5> >::type, <a href="./int.html" class="identifier">int_</a><5> > ));
|
||||
<a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( is_same< <a href="./at.html" class="identifier">at</a><s,char>::type, <a href="./void.html" class="identifier">void_</a> > ));
|
||||
</pre>
|
||||
<p id="nonunique-set-example">Constructing a <tt class="literal"><span class="pre"><a href="./set.html" class="identifier">set</a></span></tt> from a list of potentially non-unique types:</p>
|
||||
<pre class="literal-block">
|
||||
typedef <a href="./fold.html" class="identifier">fold</a><
|
||||
<a href="./vector.html" class="identifier">vector</a><int,int,long,long>
|
||||
, set0<>
|
||||
, <a href="./insert.html" class="identifier">insert</a><<a href="./placeholders.html" class="identifier">_1</a>,<a href="./placeholders.html" class="identifier">_2</a>>
|
||||
>::type s;
|
||||
|
||||
<a href="./assert-relation.html" class="identifier">BOOST_MPL_ASSERT_RELATION</a>( <a href="./size.html" class="identifier">size</a><s>::value, ==, 2 );
|
||||
</pre>
|
||||
</div>
|
||||
<div class="section" id="id79">
|
||||
<div class="section" id="id80">
|
||||
<h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3>
|
||||
<p><a class="reference internal" href="./sequences.html">Sequences</a>, <a class="reference internal" href="./variadic-sequence.html">Variadic Sequence</a>, <a class="reference internal" href="./associative-sequence.html">Associative Sequence</a>, <a class="reference internal" href="./extensible-associative-sequence.html">Extensible Associative Sequence</a>, <a class="reference internal" href="./set-c.html">set_c</a>, <a class="reference internal" href="./map.html">map</a>, <a class="reference internal" href="./vector.html">vector</a></p>
|
||||
<!-- Sequences/Classes//map |50 -->
|
||||
@@ -174,7 +186,7 @@ typedef <a href="./set.html" class="identifier">set</a>< int,long,double,<a h
|
||||
|
||||
<div class="footer-separator"></div>
|
||||
<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./deque.html" class="navigation-link">Prev</a> <a href="./map.html" class="navigation-link">Next</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./deque.html" class="navigation-link">Back</a> <a href="./map.html" class="navigation-link">Along</a></span><span class="navigation-group-separator"> | </span><span class="navigation-group"><a href="./classes.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>
|
||||
<td><div class="copyright-footer"><div class="copyright">Copyright © 2001-2011 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>
|
||||
|
@@ -37,7 +37,10 @@ Expression semantics
|
||||
--------------------
|
||||
|
||||
In the following table, ``s`` is an instance of ``set``, ``pos`` is an iterator into ``s``,
|
||||
and ``x``, ``k``, and |t1...tn| are arbitrary types.
|
||||
and ``x``, ``k``, and |t1...tn| is a set of *unique* arbitrary types. [*Note:* See `below`__ for
|
||||
an example of how to construct a ``set`` from a list of potentially non-unique types |--| *end note*\]
|
||||
|
||||
__ nonunique-set-example_
|
||||
|
||||
+---------------------------------------+-----------------------------------------------------------+
|
||||
| Expression | Semantics |
|
||||
@@ -105,6 +108,8 @@ and ``x``, ``k``, and |t1...tn| are arbitrary types.
|
||||
Example
|
||||
-------
|
||||
|
||||
Basic ``set`` invariants:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
typedef set< int,long,double,int_<5> > s;
|
||||
@@ -118,12 +123,27 @@ Example
|
||||
BOOST_MPL_ASSERT(( is_same< at<s,char>::type, void\_ > ));
|
||||
|
||||
|
||||
.. _nonunique-set-example:
|
||||
|
||||
Constructing a ``set`` from a list of potentially non-unique types:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
typedef fold<
|
||||
vector<int,int,long,long>
|
||||
, set0<>
|
||||
, insert<_1,_2>
|
||||
>::type s;
|
||||
|
||||
BOOST_MPL_ASSERT_RELATION( size<s>::value, ==, 2 );
|
||||
|
||||
|
||||
See also
|
||||
--------
|
||||
|
||||
|Sequences|, |Variadic Sequence|, |Associative Sequence|, |Extensible Associative Sequence|, |set_c|, |map|, |vector|
|
||||
|
||||
|
||||
.. copyright:: Copyright <20> 2001-2009 Aleksey Gurtovoy and David Abrahams
|
||||
.. copyright:: Copyright <20> 2001-2011 Aleksey Gurtovoy and David Abrahams
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
@@ -644,6 +644,7 @@ td,
|
||||
table.table
|
||||
th
|
||||
{
|
||||
border: solid 1px #c7c7c7;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
@@ -22,7 +22,7 @@ MPL_TEST_CASE()
|
||||
{
|
||||
typedef always<true_> always_true;
|
||||
|
||||
MPL_ASSERT(( apply< always_true > ));
|
||||
MPL_ASSERT(( apply< always_true > ));
|
||||
MPL_ASSERT(( apply0< always_true > ));
|
||||
MPL_ASSERT(( apply1< always_true,false_ > ));
|
||||
MPL_ASSERT(( apply2< always_true,false_,false_ > ));
|
||||
@@ -32,14 +32,14 @@ MPL_TEST_CASE()
|
||||
|
||||
MPL_TEST_CASE()
|
||||
{
|
||||
typedef always< int_<10> > always_10;
|
||||
|
||||
typedef always< int_<10> > always_10;
|
||||
|
||||
typedef apply< always_10 >::type res;
|
||||
typedef apply0< always_10 >::type res0;
|
||||
typedef apply1< always_10,int_<0> >::type res1;
|
||||
typedef apply2< always_10,int_<0>,int_<0> >::type res2;
|
||||
typedef apply3< always_10,int_<0>,int_<0>,int_<0> >::type res3;
|
||||
|
||||
|
||||
MPL_ASSERT_RELATION( res::value, ==, 10 );
|
||||
MPL_ASSERT_RELATION( res0::value, ==, 10 );
|
||||
MPL_ASSERT_RELATION( res1::value, ==, 10 );
|
||||
|
Reference in New Issue
Block a user