From d1a05aed0ad886efe6ad90a541e376177de616cd Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Mon, 21 Feb 2011 09:41:45 +0000 Subject: [PATCH 1/3] Closing ticket #816 [SVN r69116] --- doc/refmanual/set.html | 22 +++++++++++++++++----- doc/src/refmanual/set.rst | 24 ++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/doc/refmanual/set.html b/doc/refmanual/set.html index daab973..a17e5de 100644 --- a/doc/refmanual/set.html +++ b/doc/refmanual/set.html @@ -12,7 +12,7 @@ Front Page / Sequences / Classes / set
-

set

+

set

Description

set is a variadic, associative, extensible sequence of types that @@ -52,7 +52,8 @@ A

Expression semantics

In the following table, s is an instance of set, pos is an iterator into s, -and x, k, and t1,t2,... tn are arbitrary types.

+and x, k, and t1,t2,... 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]

@@ -151,8 +152,9 @@ the key k in +

Example

+

Basic set invariants:

 typedef set< int,long,double,int_<5> > s;
 
@@ -164,8 +166,18 @@ typedef set< int,long,double,BOOST_MPL_ASSERT(( is_same< at<s,int_<5> >::type, int_<5> > ));
 BOOST_MPL_ASSERT(( is_same< at<s,char>::type, void_ > ));
 
+

Constructing a set from a list of potentially non-unique types:

+
+typedef fold<
+      vector<int,int,long,long>
+    , set0<>
+    , insert<_1,_2>
+    >::type s;
+
+BOOST_MPL_ASSERT_RELATION( size<s>::value, ==, 2 );
+
-
- diff --git a/doc/src/refmanual/set.rst b/doc/src/refmanual/set.rst index 6d74b82..eb1d89d 100644 --- a/doc/src/refmanual/set.rst +++ b/doc/src/refmanual/set.rst @@ -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::type, void\_ > )); +.. _nonunique-set-example: + +Constructing a ``set`` from a list of potentially non-unique types: + +.. parsed-literal:: + + typedef fold< + vector + , set0<> + , insert<_1,_2> + >::type s; + + BOOST_MPL_ASSERT_RELATION( size::value, ==, 2 ); + + See also -------- |Sequences|, |Variadic Sequence|, |Associative Sequence|, |Extensible Associative Sequence|, |set_c|, |map|, |vector| -.. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams +.. copyright:: Copyright © 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) From bf895af8f710056da6d9e4bcf8e30d23d4ef32c0 Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Mon, 21 Feb 2011 10:00:08 +0000 Subject: [PATCH 2/3] Docs/cosmetic: fix td/th border style in Firefox [SVN r69117] --- doc/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/style.css b/doc/style.css index a49fb87..4de2787 100644 --- a/doc/style.css +++ b/doc/style.css @@ -644,6 +644,7 @@ td, table.table th { + border: solid 1px #c7c7c7; vertical-align: top; } From ea6c446ad6b17dc55d857e42a92337189100694b Mon Sep 17 00:00:00 2001 From: Daniel James Date: Mon, 17 Mar 2014 11:38:13 +0000 Subject: [PATCH 3/3] Fix whitespace in 'test/always.cpp'. --- test/always.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/always.cpp b/test/always.cpp index 53294b1..c879b97 100644 --- a/test/always.cpp +++ b/test/always.cpp @@ -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 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 );