Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56700 - in branches/release: . boost/algorithm/string boost/archive boost/fusion boost/graph boost/numeric/ublas boost/program_options boost/property_tree boost/python boost/regex boost/serialization boost/signals boost/signals2 boost/system boost/unordered boost/unordered/detail boost/utility libs libs/fusion libs/graph_parallel libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/numeric/ublas libs/program_options libs/property_tree libs/python libs/regex libs/serialization libs/signals libs/signals2 libs/spirit/classic/example libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/system libs/timer libs/unordered/doc libs/unordered/test/exception libs/unordered/test/helpers libs/unordered/test/objects libs/unordered/test/unordered libs/utility status tools/boostbook/test/doxygen/boost tools/build/v2 tools/regression
From: daniel_james_at_[hidden]
Date: 2009-10-10 09:52:55


Author: danieljames
Date: 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
New Revision: 56700
URL: http://svn.boost.org/trac/boost/changeset/56700

Log:
Merge unordred changes.

Merged revisions 56441,56461,56468,56557-56562 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r56441 | danieljames | 2009-09-27 20:12:04 +0100 (Sun, 27 Sep 2009) | 1 line
  
  Try supporting reference parameters in pairs. Probably not required.
........
  r56461 | danieljames | 2009-09-29 00:06:03 +0100 (Tue, 29 Sep 2009) | 1 line
  
  Remove the optimization for std::pair with a key reference. It'll be too much hassle to get a very unusual use case to work on all compilers.
........
  r56468 | danieljames | 2009-09-29 08:46:44 +0100 (Tue, 29 Sep 2009) | 1 line
  
  Just remove the test since the test itself doesn't work on most compilers.
........
  r56557 | danieljames | 2009-10-03 17:40:26 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Fix the iterator category.
........
  r56558 | danieljames | 2009-10-03 17:40:53 +0100 (Sat, 03 Oct 2009) | 2 lines
  
  Update reference docs to latest version of draft standard and fill in
  some missing details.
........
  r56559 | danieljames | 2009-10-03 17:41:11 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Stricter insert exception tests.
........
  r56560 | danieljames | 2009-10-03 17:41:32 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Insert using initializer lists.
........
  r56561 | danieljames | 2009-10-03 17:42:00 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Update the unordered rationale.
........
  r56562 | danieljames | 2009-10-03 17:42:20 +0100 (Sat, 03 Oct 2009) | 1 line
  
  Make sure inserting from a range of types other than the value type is better tested.
........

Properties modified:
   branches/release/ (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/archive/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/python/ (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2/ (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/utility/value_init.hpp (props changed)
   branches/release/index.html (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/libraries.htm (props changed)
   branches/release/libs/maintainers.txt (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/program_options/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/signals2/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/value_init.htm (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/status/ (props changed)
   branches/release/tools/build/v2/ (props changed)
   branches/release/tools/regression/ (props changed)
Text files modified:
   branches/release/boost/unordered/detail/extract_key.hpp | 15 --
   branches/release/boost/unordered/detail/unique.hpp | 7
   branches/release/boost/unordered/unordered_map.hpp | 14 ++
   branches/release/boost/unordered/unordered_set.hpp | 14 ++
   branches/release/libs/unordered/doc/intro.qbk | 2
   branches/release/libs/unordered/doc/rationale.qbk | 122 ++++--------------
   branches/release/libs/unordered/doc/ref.xml | 260 +++++++++++++++++++++++++++++++++++++--
   branches/release/libs/unordered/test/exception/insert_exception_tests.cpp | 14 +-
   branches/release/libs/unordered/test/helpers/strong.hpp | 8
   branches/release/libs/unordered/test/objects/test.hpp | 4
   branches/release/libs/unordered/test/unordered/insert_tests.cpp | 75 +++++++++++
   branches/release/tools/boostbook/test/doxygen/boost/example.hpp | 5
   12 files changed, 400 insertions(+), 140 deletions(-)

Modified: branches/release/boost/unordered/detail/extract_key.hpp
==============================================================================
--- branches/release/boost/unordered/detail/extract_key.hpp (original)
+++ branches/release/boost/unordered/detail/extract_key.hpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -106,21 +106,6 @@
             {
                 return v.first;
             }
-/*
- template <class Second>
- static key_type const& extract(
- std::pair<key_type&, Second> const& v)
- {
- return v.first;
- }
-
- template <class Second>
- static key_type const& extract(
- std::pair<key_type const&, Second> const& v)
- {
- return v.first;
- }
-*/
 
 #if defined(BOOST_UNORDERED_STD_FORWARD)
             template <class Arg1, class... Args>

Modified: branches/release/boost/unordered/detail/unique.hpp
==============================================================================
--- branches/release/boost/unordered/detail/unique.hpp (original)
+++ branches/release/boost/unordered/detail/unique.hpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -324,10 +324,9 @@
 
         do {
             // No side effects in this initial code
- // Note: can't use get_key as '*i' might not be value_type.
- // TODO: Check if std::pair has an appropriate constructor. If not
- // that might not be true.
- // TODO: Test this line better.
+ // Note: can't use get_key as '*i' might not be value_type - it could
+ // be a pair with first_types as key_type without const or a
+ // different second_type.
             key_type const& k = extractor::extract(*i);
             std::size_t hash_value = this->hash_function()(k);
             bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value);

Modified: branches/release/boost/unordered/unordered_map.hpp
==============================================================================
--- branches/release/boost/unordered/unordered_map.hpp (original)
+++ branches/release/boost/unordered/unordered_map.hpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -343,6 +343,13 @@
             table_.insert_range(first, last);
         }
 
+#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
+ void insert(std::initializer_list<value_type> list)
+ {
+ table_.insert_range(list.begin(), list.end());
+ }
+#endif
+
         iterator erase(const_iterator position)
         {
             return iterator(table_.erase(get(position)));
@@ -837,6 +844,13 @@
             table_.insert_range(first, last);
         }
 
+#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
+ void insert(std::initializer_list<value_type> list)
+ {
+ table_.insert_range(list.begin(), list.end());
+ }
+#endif
+
         iterator erase(const_iterator position)
         {
             return iterator(table_.erase(get(position)));

Modified: branches/release/boost/unordered/unordered_set.hpp
==============================================================================
--- branches/release/boost/unordered/unordered_set.hpp (original)
+++ branches/release/boost/unordered/unordered_set.hpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -337,6 +337,13 @@
             table_.insert_range(first, last);
         }
 
+#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
+ void insert(std::initializer_list<value_type> list)
+ {
+ table_.insert_range(list.begin(), list.end());
+ }
+#endif
+
         iterator erase(const_iterator position)
         {
             return iterator(table_.erase(get(position)));
@@ -793,6 +800,13 @@
             table_.insert_range(first, last);
         }
 
+#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
+ void insert(std::initializer_list<value_type> list)
+ {
+ table_.insert_range(list.begin(), list.end());
+ }
+#endif
+
         iterator erase(const_iterator position)
         {
             return iterator(table_.erase(get(position)));

Modified: branches/release/libs/unordered/doc/intro.qbk
==============================================================================
--- branches/release/libs/unordered/doc/intro.qbk (original)
+++ branches/release/libs/unordered/doc/intro.qbk 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -9,7 +9,7 @@
     [@http://www.boost.org/doc/html/boost_tr1.html
     Boost.TR1]]
 [def __draft__
- [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2691.pdf
+ [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2960.pdf
     Working Draft of the C++ Standard]]
 [def __hash-table__ [@http://en.wikipedia.org/wiki/Hash_table
     hash table]]

Modified: branches/release/libs/unordered/doc/rationale.qbk
==============================================================================
--- branches/release/libs/unordered/doc/rationale.qbk (original)
+++ branches/release/libs/unordered/doc/rationale.qbk 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -5,12 +5,6 @@
 [def __wang__
     [@http://www.concentric.net/~Ttwang/tech/inthash.htm
     Thomas Wang's article on integer hash functions]]
-[def __n2345__
- [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2345.pdf
- N2345, 'Placement Insert for Containers']]
-[def __n2369__
- [@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2369.pdf
- the August 2007 version of the working draft standard]]
 
 [section:rationale Implementation Rationale]
 
@@ -99,105 +93,49 @@
 [h2 Equality operators]
 
 `operator==` and `operator!=` are not included in the standard, but I've
-added them as I think they could be useful and can be efficiently
-implemented. They are specified
-differently to the standard associative containers, comparing keys
-using the equality predicate rather than `operator==`. This is inconsistent
-with the other containers but it is probably closer to user's expectations.
+added them as I think they could be useful and can be implemented
+fairly efficiently. They are specified differently to the other standard
+containers, comparing keys using the equality predicate rather than
+`operator==`.
+
+It's also different to the proposal
+[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2944.pdf n2944].
+which uses the equality operators for the whole of `value_type`. This
+implementation just uses the key equality function for the key,
+and `mapped_type`'s equality operator in `unordered_map` and
+`unordered_multimap` for the mapped part of the element.
+
+Also, in `unordered_multimap`, the mapped values for a group of elements with
+equivalent keys are only considered equal if they are in the same order,
+in n2944 they just need to be a permutation of each other. Since the
+order of elements with equal keys is now defined to be stable, it seems to me
+that their order can be considered part of the container's value.
 
 [h2 Active Issues and Proposals]
 
-[h3 Removing unused allocator functions]
+[h3 C++0x allocators]
 
-In
-[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2257.html
-N2257, removing unused allocator functions],
-Matt Austern suggests removing the `construct`, `destroy` and `address` member
-functions - all of which Boost.Unordered calls. Changing this will simplify the
-implementation, as well as make supporting `emplace` easier, but means that the
-containers won't support allocators which require these methods to be called.
-Detlef Vollmann opposed this change in
-[@http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2007/n2339.htm N2339].
+Recent drafts have included an overhaul of the allocators, but this was
+dependent on concepts which are no longer in the standard.
+[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2946.pdf n2946]
+attempts to respecify them without concepts. I'll try to implement this (or
+an appropriate later version) in a future version of boost, possibly changed
+a little to accomodate non-C++0x compilers.
 
 [h3 Swapping containers with unequal allocators]
 
 It isn't clear how to swap containers when their allocators aren't equal.
 This is
 [@http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#431
-Issue 431: Swapping containers with unequal allocators].
-
-Howard Hinnant wrote about this in
-[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1599.html N1599]
-and suggested swapping both the allocators and the containers' contents.
-But the committee have now decided that `swap` should do a fast swap if the
-allocator is Swappable and a slow swap using copy construction otherwise. To
-make this distinction requires concepts.
-
-In
-[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2387.pdf
-N2387, Omnibus Allocator Fix-up Proposals],
-Pablo Halpern suggests that there are actually two distinct allocator models,
-"Moves with Value" and "Scoped" which behave differently:
-
-[:
-When allocators are allowed to have state, it is necessary to have a model for
-determining from where an object obtains its allocator. We’ve identified two such
-models: the “Moves with Value” allocator model and the “Scoped” allocator model.
-
-In the “Moves with Value” allocator model, the copy constructor of an allocator-aware
-class will copy both the value and the allocator from its argument. This is the model
-specified in the C++03 standard. With this model, inserting an object into a container
-usually causes the new container item to copy the allocator from the object that was
-inserted. This model can be useful in special circumstances, e.g., if the items within a
-container use an allocator that is specially tuned to the item’s type.
-
-In the “Scoped” allocator model, the allocator used to construct an object is determined
-by the context of that object, much like a storage class. With this model, inserting an
-object into a container causes the new container item to use the same allocator as the
-container. To avoid allocators being used in the wrong context, the allocator is never
-copied during copy or move construction. Thus, it is possible using this model to use
-allocators based on short-lived resources without fear that an object will transfer its
-allocator to a copy that might outlive the (shared) allocator resource. This model is
-reasonably safe and generally useful on a large scale. There was strong support in the
-2005 Tremblant meeting for pursuing an allocator model that propagates allocators
-from container to contained objects.
-]
-
-With these models the choice becomes clearer:
-
-[:
-I introduced the “Moves with Value” allocator model and the
-“Scoped” allocator model. In the former case, the allocator is copied when the container
-is copy-constructed. In the latter case it is not. Swapping the allocators is the right thing
-to do if the containers conform to the “Moves with Value” allocator model and
-absolutely the wrong thing to do if the containers conform to the “Scoped” allocator
-model. With the two allocator models well-defined, the desired behavior becomes clear.
-]
-
-The proposal is that allocators are swapped if the allocator follows the
-"Moves with Value" model and the allocator is swappable. Otherwise a slow swap
-is used. Since containers currently only support the "Moves with Value" model
-this is consistent with the committee's current recommendation (although it
-suggests using a trait to detect if the allocator is swappable rather than a
-concept).
-
-Since there is currently neither have a swappable trait or concept for
-allocators this implementation always performs a slow swap.
+Issue 431: Swapping containers with unequal allocators]. This has been resolved
+with the new allocator specification, so this should be fixed when
+support is added.
 
 [h3 Are insert and erase stable for unordered_multiset and unordered_multimap?]
 
-It is not specified if `unordered_multiset` and `unordered_multimap` preserve the order
+It wan't specified if `unordered_multiset` and `unordered_multimap` preserve the order
 of elements with equivalent keys (i.e. if they're stable under `insert` and `erase`).
-This is [@http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#518 issue 581].
-The current proposal is that insert, erase and rehash are stable - so they are here.
-(Update: during the release of this version, this requirement was added to
-[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf
-the lastest working draft]).
-
-[h3 const_local_iterator cbegin, cend missing from TR1]
-
-[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2684.html#691
-Issue 691] is that `cbegin` and `cend` are missing for local iterators.
-The current resolution is that they'll be added, so I've added them.
+Since [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf
+n2691] it's been specified that they do and this implementation follows that.
 
 [endsect]

Modified: branches/release/libs/unordered/doc/ref.xml
==============================================================================
--- branches/release/libs/unordered/doc/ref.xml (original)
+++ branches/release/libs/unordered/doc/ref.xml 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -23,8 +23,10 @@
             An unordered associative container that stores unique values.
           </simpara></purpose>
           <description>
- <para>For the normative reference see chapter 23 of
- <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
+ <para>Based on chapter 23 of
+ <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2960.pdf">the working draft of the C++ standard [n2960]</ulink>.
+ But without the updated rules for allocators.
+ </para>
             <para><emphasis role="bold">Template Parameters</emphasis>
               <informaltable>
                 <tgroup cols="2">
@@ -93,7 +95,7 @@
             <type><emphasis>implementation-defined</emphasis></type>
             <description>
               <para>A constant iterator whose value type is <type>value_type</type>. </para>
- <para>Any iterator category except output iterator.</para>
+ <para>The iterator category is at least a forward iterator.</para>
               <para>Convertible to <type>const_iterator</type>.</para>
             </description>
           </typedef>
@@ -101,7 +103,7 @@
             <type><emphasis>implementation-defined</emphasis></type>
             <description>
               <para>A constant iterator whose value type is <type>value_type</type>. </para>
- <para>Any iterator category except output iterator.</para>
+ <para>The iterator category is at least a forward iterator.</para>
             </description>
           </typedef>
           <typedef name="local_iterator">
@@ -180,6 +182,26 @@
             <description>
               <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para>
             </description>
+ <requires>
+ <para><code>value_type</code> is copy constructible</para>
+ </requires>
+ </constructor>
+ <constructor>
+ <parameter>
+ <paramtype>unordered_set &amp;&amp;</paramtype>
+ </parameter>
+ <description>
+ <para>The move constructor.</para>
+ </description>
+ <notes>
+ <para>This is emulated on compilers without rvalue references.</para>
+ </notes>
+ <requires>
+ <para>
+ <code>value_type</code> is move constructible.
+ (TODO: This is not actually required in this implementation).
+ </para>
+ </requires>
           </constructor>
           <constructor specifiers="explicit">
             <parameter name="a">
@@ -201,6 +223,9 @@
             </description>
           </constructor>
           <destructor>
+ <notes>
+ <para>The destructor is applied to every element, and all memory is deallocated</para>
+ </notes>
           </destructor>
           <method name="operator=">
             <parameter>
@@ -210,6 +235,38 @@
             <description>
               <para>The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.</para>
             </description>
+ <notes>
+ <para>
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature <code>operator=(unordered_set)</code>
+ in order to emulate move semantics.
+ </para>
+ </notes>
+ <requires>
+ <para><code>value_type</code> is copy constructible</para>
+ </requires>
+ </method>
+ <method name="operator=">
+ <parameter>
+ <paramtype>unordered_set &amp;&amp;</paramtype>
+ </parameter>
+ <type>unordered_set&amp;</type>
+ <description>
+ <para>The move assignment operator.</para>
+ </description>
+ <notes>
+ <para>
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature <code>operator=(unordered_set)</code>
+ in order to emulate move semantics.
+ </para>
+ </notes>
+ <requires>
+ <para>
+ <code>value_type</code> is move constructible.
+ (TODO: This is not actually required in this implementation).
+ </para>
+ </requires>
           </method>
           <method name="get_allocator" cv="const">
             <type>allocator_type</type>
@@ -761,8 +818,10 @@
             An unordered associative container that stores values. The same key can be stored multiple times.
           </simpara></purpose>
           <description>
- <para>For the normative reference see chapter 23 of
- <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
+ <para>Based on chapter 23 of
+ <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2960.pdf">the working draft of the C++ standard [n2960]</ulink>.
+ But without the updated rules for allocators.
+ </para>
             <para><emphasis role="bold">Template Parameters</emphasis>
               <informaltable>
                 <tgroup cols="2">
@@ -831,7 +890,7 @@
             <type><emphasis>implementation-defined</emphasis></type>
             <description>
               <para>A constant iterator whose value type is <type>value_type</type>. </para>
- <para>Any iterator category except output iterator.</para>
+ <para>The iterator category is at least a forward iterator.</para>
               <para>Convertible to <type>const_iterator</type>.</para>
             </description>
           </typedef>
@@ -839,7 +898,7 @@
             <type><emphasis>implementation-defined</emphasis></type>
             <description>
               <para>A constant iterator whose value type is <type>value_type</type>. </para>
- <para>Any iterator category except output iterator.</para>
+ <para>The iterator category is at least a forward iterator.</para>
             </description>
           </typedef>
           <typedef name="local_iterator">
@@ -918,6 +977,26 @@
             <description>
               <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para>
             </description>
+ <requires>
+ <para><code>value_type</code> is copy constructible</para>
+ </requires>
+ </constructor>
+ <constructor>
+ <parameter>
+ <paramtype>unordered_multiset &amp;&amp;</paramtype>
+ </parameter>
+ <description>
+ <para>The move constructor.</para>
+ </description>
+ <notes>
+ <para>This is emulated on compilers without rvalue references.</para>
+ </notes>
+ <requires>
+ <para>
+ <code>value_type</code> is move constructible.
+ (TODO: This is not actually required in this implementation).
+ </para>
+ </requires>
           </constructor>
           <constructor specifiers="explicit">
             <parameter name="a">
@@ -939,6 +1018,9 @@
             </description>
           </constructor>
           <destructor>
+ <notes>
+ <para>The destructor is applied to every element, and all memory is deallocated</para>
+ </notes>
           </destructor>
           <method name="operator=">
             <parameter>
@@ -948,6 +1030,38 @@
             <description>
               <para>The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.</para>
             </description>
+ <notes>
+ <para>
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature <code>operator=(unordered_multiset)</code>
+ in order to emulate move semantics.
+ </para>
+ </notes>
+ <requires>
+ <para><code>value_type</code> is copy constructible</para>
+ </requires>
+ </method>
+ <method name="operator=">
+ <parameter>
+ <paramtype>unordered_multiset &amp;&amp;</paramtype>
+ </parameter>
+ <type>unordered_multiset&amp;</type>
+ <description>
+ <para>The move assignment operator.</para>
+ </description>
+ <notes>
+ <para>
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature <code>operator=(unordered_multiset)</code>
+ in order to emulate move semantics.
+ </para>
+ </notes>
+ <requires>
+ <para>
+ <code>value_type</code> is move constructible.
+ (TODO: This is not actually required in this implementation).
+ </para>
+ </requires>
           </method>
           <method name="get_allocator" cv="const">
             <type>allocator_type</type>
@@ -1503,8 +1617,10 @@
             An unordered associative container that associates unique keys with another value.
           </simpara></purpose>
           <description>
- <para>For the normative reference see chapter 23 of
- <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
+ <para>Based on chapter 23 of
+ <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2960.pdf">the working draft of the C++ standard [n2960]</ulink>.
+ But without the updated rules for allocators.
+ </para>
             <para><emphasis role="bold">Template Parameters</emphasis>
               <informaltable>
                 <tgroup cols="2">
@@ -1579,7 +1695,7 @@
             <type><emphasis>implementation-defined</emphasis></type>
             <description>
               <para>A iterator whose value type is <type>value_type</type>. </para>
- <para>Any iterator category except output iterator.</para>
+ <para>The iterator category is at least a forward iterator.</para>
               <para>Convertible to <type>const_iterator</type>.</para>
             </description>
           </typedef>
@@ -1587,7 +1703,7 @@
             <type><emphasis>implementation-defined</emphasis></type>
             <description>
               <para>A constant iterator whose value type is <type>value_type</type>. </para>
- <para>Any iterator category except output iterator.</para>
+ <para>The iterator category is at least a forward iterator.</para>
             </description>
           </typedef>
           <typedef name="local_iterator">
@@ -1666,6 +1782,26 @@
             <description>
               <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para>
             </description>
+ <requires>
+ <para><code>value_type</code> is copy constructible</para>
+ </requires>
+ </constructor>
+ <constructor>
+ <parameter>
+ <paramtype>unordered_map &amp;&amp;</paramtype>
+ </parameter>
+ <description>
+ <para>The move constructor.</para>
+ </description>
+ <notes>
+ <para>This is emulated on compilers without rvalue references.</para>
+ </notes>
+ <requires>
+ <para>
+ <code>value_type</code> is move constructible.
+ (TODO: This is not actually required in this implementation).
+ </para>
+ </requires>
           </constructor>
           <constructor specifiers="explicit">
             <parameter name="a">
@@ -1687,6 +1823,9 @@
             </description>
           </constructor>
           <destructor>
+ <notes>
+ <para>The destructor is applied to every element, and all memory is deallocated</para>
+ </notes>
           </destructor>
           <method name="operator=">
             <parameter>
@@ -1696,6 +1835,38 @@
             <description>
               <para>The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.</para>
             </description>
+ <notes>
+ <para>
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature <code>operator=(unordered_map)</code>
+ in order to emulate move semantics.
+ </para>
+ </notes>
+ <requires>
+ <para><code>value_type</code> is copy constructible</para>
+ </requires>
+ </method>
+ <method name="operator=">
+ <parameter>
+ <paramtype>unordered_map &amp;&amp;</paramtype>
+ </parameter>
+ <type>unordered_map&amp;</type>
+ <description>
+ <para>The move assignment operator.</para>
+ </description>
+ <notes>
+ <para>
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature <code>operator=(unordered_map)</code>
+ in order to emulate move semantics.
+ </para>
+ </notes>
+ <requires>
+ <para>
+ <code>value_type</code> is move constructible.
+ (TODO: This is not actually required in this implementation).
+ </para>
+ </requires>
           </method>
           <method name="get_allocator" cv="const">
             <type>allocator_type</type>
@@ -2290,8 +2461,10 @@
             An unordered associative container that associates keys with another value. The same key can be stored multiple times.
           </simpara></purpose>
           <description>
- <para>For the normative reference see chapter 23 of
- <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf">the working draft of the C++ standard [n2691].</ulink></para>
+ <para>Based on chapter 23 of
+ <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2960.pdf">the working draft of the C++ standard [n2960]</ulink>.
+ But without the updated rules for allocators.
+ </para>
             <para><emphasis role="bold">Template Parameters</emphasis>
               <informaltable>
                 <tgroup cols="2">
@@ -2366,7 +2539,7 @@
             <type><emphasis>implementation-defined</emphasis></type>
             <description>
               <para>A iterator whose value type is <type>value_type</type>. </para>
- <para>Any iterator category except output iterator.</para>
+ <para>The iterator category is at least a forward iterator.</para>
               <para>Convertible to <type>const_iterator</type>.</para>
             </description>
           </typedef>
@@ -2374,7 +2547,7 @@
             <type><emphasis>implementation-defined</emphasis></type>
             <description>
               <para>A constant iterator whose value type is <type>value_type</type>. </para>
- <para>Any iterator category except output iterator.</para>
+ <para>The iterator category is at least a forward iterator.</para>
             </description>
           </typedef>
           <typedef name="local_iterator">
@@ -2453,6 +2626,26 @@
             <description>
               <para>The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.</para>
             </description>
+ <requires>
+ <para><code>value_type</code> is copy constructible</para>
+ </requires>
+ </constructor>
+ <constructor>
+ <parameter>
+ <paramtype>unordered_multimap &amp;&amp;</paramtype>
+ </parameter>
+ <description>
+ <para>The move constructor.</para>
+ </description>
+ <notes>
+ <para>This is emulated on compilers without rvalue references.</para>
+ </notes>
+ <requires>
+ <para>
+ <code>value_type</code> is move constructible.
+ (TODO: This is not actually required in this implementation).
+ </para>
+ </requires>
           </constructor>
           <constructor specifiers="explicit">
             <parameter name="a">
@@ -2474,6 +2667,9 @@
             </description>
           </constructor>
           <destructor>
+ <notes>
+ <para>The destructor is applied to every element, and all memory is deallocated</para>
+ </notes>
           </destructor>
           <method name="operator=">
             <parameter>
@@ -2483,6 +2679,38 @@
             <description>
               <para>The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.</para>
             </description>
+ <notes>
+ <para>
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature <code>operator=(unordered_multimap)</code>
+ in order to emulate move semantics.
+ </para>
+ </notes>
+ <requires>
+ <para><code>value_type</code> is copy constructible</para>
+ </requires>
+ </method>
+ <method name="operator=">
+ <parameter>
+ <paramtype>unordered_multimap &amp;&amp;</paramtype>
+ </parameter>
+ <type>unordered_multimap&amp;</type>
+ <description>
+ <para>The move assignment operator.</para>
+ </description>
+ <notes>
+ <para>
+ On compilers without rvalue references, there is a single assignment
+ operator with the signature <code>operator=(unordered_multimap)</code>
+ in order to emulate move semantics.
+ </para>
+ </notes>
+ <requires>
+ <para>
+ <code>value_type</code> is move constructible.
+ (TODO: This is not actually required in this implementation).
+ </para>
+ </requires>
           </method>
           <method name="get_allocator" cv="const">
             <type>allocator_type</type>

Modified: branches/release/libs/unordered/test/exception/insert_exception_tests.cpp
==============================================================================
--- branches/release/libs/unordered/test/exception/insert_exception_tests.cpp (original)
+++ branches/release/libs/unordered/test/exception/insert_exception_tests.cpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -31,7 +31,7 @@
         std::string scope(test::scope);
 
         if(scope.find("hash::operator()") == std::string::npos)
- strong.test(x);
+ strong.test(x, test::exception::detail::tracker.count_allocations);
         test::check_equivalent_keys(x);
     }
 };
@@ -47,7 +47,7 @@
         for(BOOST_DEDUCED_TYPENAME test::random_values<T>::const_iterator
                 it = this->values.begin(), end = this->values.end(); it != end; ++it)
         {
- strong.store(x);
+ strong.store(x, test::exception::detail::tracker.count_allocations);
             x.emplace(*it);
         }
     }
@@ -64,7 +64,7 @@
         for(BOOST_DEDUCED_TYPENAME test::random_values<T>::const_iterator
                 it = this->values.begin(), end = this->values.end(); it != end; ++it)
         {
- strong.store(x);
+ strong.store(x, test::exception::detail::tracker.count_allocations);
             x.insert(*it);
         }
     }
@@ -79,7 +79,7 @@
         for(BOOST_DEDUCED_TYPENAME test::random_values<T>::const_iterator
                 it = this->values.begin(), end = this->values.end(); it != end; ++it)
         {
- strong.store(x);
+ strong.store(x, test::exception::detail::tracker.count_allocations);
             x.insert(x.begin(), *it);
         }
     }
@@ -106,7 +106,7 @@
         for(BOOST_DEDUCED_TYPENAME test::random_values<T>::const_iterator
                 it = this->values.begin(), end = this->values.end(); it != end; ++it)
         {
- strong.store(x);
+ strong.store(x, test::exception::detail::tracker.count_allocations);
             x.insert(it, boost::next(it));
         }
     }
@@ -144,7 +144,7 @@
             it = boost::next(this->values.begin(), x.size()), end = this->values.end();
             it != end && count < 10; ++it, ++count)
         {
- strong.store(x);
+ strong.store(x, test::exception::detail::tracker.count_allocations);
             pos = x.insert(pos, *it);
         }
 
@@ -167,7 +167,7 @@
             it = boost::next(this->values.begin(), x.size()), end = this->values.end();
             it != end && count < 10; ++it, ++count)
         {
- strong.store(x);
+ strong.store(x, test::exception::detail::tracker.count_allocations);
             x.insert(*it);
         }
 

Modified: branches/release/libs/unordered/test/helpers/strong.hpp
==============================================================================
--- branches/release/libs/unordered/test/helpers/strong.hpp (original)
+++ branches/release/libs/unordered/test/helpers/strong.hpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -20,18 +20,22 @@
     {
         typedef test::list<BOOST_DEDUCED_TYPENAME X::value_type> values_type;
         values_type values_;
+ unsigned int allocations_;
     public:
- void store(X const& x) {
+ void store(X const& x, unsigned int allocations = 0) {
             DISABLE_EXCEPTIONS;
             values_.clear();
             values_.insert(x.cbegin(), x.cend());
+ allocations_ = allocations;
         }
 
- void test(X const& x) const {
+ void test(X const& x, unsigned int allocations = 0) const {
             if(!(x.size() == values_.size() &&
                     std::equal(x.cbegin(), x.cend(), values_.begin(),
                         test::equivalent)))
                 BOOST_ERROR("Strong exception safety failure.");
+ if(allocations != allocations_)
+ BOOST_ERROR("Strong exception failure: extra allocations.");
         }
     };
 }

Modified: branches/release/libs/unordered/test/objects/test.hpp
==============================================================================
--- branches/release/libs/unordered/test/objects/test.hpp (original)
+++ branches/release/libs/unordered/test/objects/test.hpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -93,6 +93,10 @@
             return x1.type_ != x2.type_;
         }
     };
+
+ std::size_t hash_value(test::object const& x) {
+ return hash()(x);
+ }
 
     class less
     {

Modified: branches/release/libs/unordered/test/unordered/insert_tests.cpp
==============================================================================
--- branches/release/libs/unordered/test/unordered/insert_tests.cpp (original)
+++ branches/release/libs/unordered/test/unordered/insert_tests.cpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -313,10 +313,12 @@
     test::check_equivalent_keys(x);
 }
 
+// Some tests for when the range's value type doesn't match the container's value type.
+
 template <class X>
-void associative_insert_range_test(X*, test::random_generator generator = test::default_generator)
+void map_insert_range_test1(X*, test::random_generator generator = test::default_generator)
 {
- std::cerr<<"associative_insert_range_test\n";
+ std::cerr<<"map_insert_range_test1\n";
 
     typedef test::list<std::pair<BOOST_DEDUCED_TYPENAME X::key_type, BOOST_DEDUCED_TYPENAME X::mapped_type> > list;
     test::random_values<X> v(1000, generator);
@@ -327,6 +329,20 @@
     test::check_equivalent_keys(x);
 }
 
+template <class X>
+void map_insert_range_test2(X*, test::random_generator generator = test::default_generator)
+{
+ std::cerr<<"map_insert_range_test2\n";
+
+ typedef test::list<std::pair<BOOST_DEDUCED_TYPENAME X::key_type const, int> > list;
+ test::random_values<boost::unordered_map<BOOST_DEDUCED_TYPENAME X::key_type, int> > v(1000, generator);
+ list l(v.begin(), v.end());
+
+ X x; x.insert(l.begin(), l.end());
+
+ test::check_equivalent_keys(x);
+}
+
 boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_set;
 boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_multiset;
 boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator<test::object> >* test_map;
@@ -367,11 +383,64 @@
     ((default_generator)(generate_collisions))
 )
 
-UNORDERED_TEST(associative_insert_range_test,
+UNORDERED_TEST(map_insert_range_test1,
+ ((test_map)(test_multimap))
+ ((default_generator)(generate_collisions))
+)
+
+UNORDERED_TEST(map_insert_range_test2,
     ((test_map)(test_multimap))
     ((default_generator)(generate_collisions))
 )
 
+#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
+
+UNORDERED_AUTO_TEST(insert_initializer_list_set)
+{
+ boost::unordered_set<int> set;
+ set.insert({1,2,3,1});
+ BOOST_TEST_EQ(set.size(), 3u);
+ BOOST_TEST(set.find(1) != set.end());
+ BOOST_TEST(set.find(4) == set.end());
+}
+
+UNORDERED_AUTO_TEST(insert_initializer_list_multiset)
+{
+ boost::unordered_multiset<std::string> multiset;
+ multiset.insert({});
+ BOOST_TEST(multiset.empty());
+ multiset.insert({"a"});
+ BOOST_TEST_EQ(multiset.size(), 1u);
+ BOOST_TEST(multiset.find("a") != multiset.end());
+ BOOST_TEST(multiset.find("b") == multiset.end());
+ multiset.insert({"a","b"});
+ BOOST_TEST(multiset.size() == 3);
+ BOOST_TEST_EQ(multiset.count("a"), 2u);
+ BOOST_TEST_EQ(multiset.count("b"), 1u);
+ BOOST_TEST_EQ(multiset.count("c"), 0u);
+}
+
+UNORDERED_AUTO_TEST(insert_initializer_list_map)
+{
+ boost::unordered_map<std::string, std::string> map;
+ map.insert({});
+ BOOST_TEST(map.empty());
+ map.insert({{"a", "b"},{"a", "b"},{"d", ""}});
+ BOOST_TEST_EQ(map.size(), 2u);
+}
+
+UNORDERED_AUTO_TEST(insert_initializer_list_multimap)
+{
+ boost::unordered_multimap<std::string, std::string> multimap;
+ multimap.insert({});
+ BOOST_TEST(multimap.empty());
+ multimap.insert({{"a", "b"},{"a", "b"},{"d", ""}});
+ BOOST_TEST_EQ(multimap.size(), 3u);
+ BOOST_TEST_EQ(multimap.count("a"), 2u);
+}
+
+#endif
+
 }
 
 RUN_TESTS()

Modified: branches/release/tools/boostbook/test/doxygen/boost/example.hpp
==============================================================================
--- branches/release/tools/boostbook/test/doxygen/boost/example.hpp (original)
+++ branches/release/tools/boostbook/test/doxygen/boost/example.hpp 2009-10-10 09:52:53 EDT (Sat, 10 Oct 2009)
@@ -20,6 +20,11 @@
         mutable int mutable_integer;
         const int const_integer;
         static const int static_const_integer;
+
+ class inner_class {
+ public:
+ int x;
+ }
 
         enum class_enum { enumerator };
         


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk