From da7a5bf269be30a9ce7408e51dc0ba4f6f77e291 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 4 Sep 2016 08:07:51 +0100 Subject: [PATCH 1/3] Fix insert from range documentation. Was the same for containers with unique and equivalent keys. --- doc/ref.php | 6 +++++- doc/ref.xml | 14 ++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/ref.php b/doc/ref.php index 0a474807..b516a4f2 100644 --- a/doc/ref.php +++ b/doc/ref.php @@ -640,7 +640,11 @@ EOL; void - Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent . + Inserts a range of elements into the container. + + Elements are inserted if and only if there is no element in the container with an equivalent . + + value_type is EmplaceConstructible into diff --git a/doc/ref.xml b/doc/ref.xml index f16e6028..406790b5 100644 --- a/doc/ref.xml +++ b/doc/ref.xml @@ -537,7 +537,9 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) void - Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent value. + Inserts a range of elements into the container. + Elements are inserted if and only if there is no element in the container with an equivalent value. + value_type is EmplaceConstructible into @@ -1569,7 +1571,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) void - Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent value. + Inserts a range of elements into the container. + value_type is EmplaceConstructible into @@ -2618,7 +2621,9 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) void - Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent key. + Inserts a range of elements into the container. + Elements are inserted if and only if there is no element in the container with an equivalent key. + value_type is EmplaceConstructible into @@ -3697,7 +3702,8 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) void - Inserts a range of elements into the container. Elements are inserted if and only if there is no element in the container with an equivalent key. + Inserts a range of elements into the container. + value_type is EmplaceConstructible into From 8bb94734435b21cbda0e73a9d4d3050900f66704 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 4 Sep 2016 08:07:51 +0100 Subject: [PATCH 2/3] Document assignment from initializer list. --- doc/ref.php | 15 ++++++++++++++ doc/ref.xml | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/doc/ref.php b/doc/ref.php index b516a4f2..0f66d789 100644 --- a/doc/ref.php +++ b/doc/ref.php @@ -358,6 +358,21 @@ EOL; + + + initializer_list<value_type> + + & + + Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed. + + + + value_type is CopyInsertable into the container and + CopyAssignable. + + + allocator_type diff --git a/doc/ref.xml b/doc/ref.xml index 406790b5..b0f45726 100644 --- a/doc/ref.xml +++ b/doc/ref.xml @@ -299,6 +299,21 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + + initializer_list<value_type> + + unordered_set& + + Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed. + + + + value_type is CopyInsertable into the container and + CopyAssignable. + + + allocator_type @@ -1336,6 +1351,21 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + + initializer_list<value_type> + + unordered_multiset& + + Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed. + + + + value_type is CopyInsertable into the container and + CopyAssignable. + + + allocator_type @@ -2383,6 +2413,21 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + + initializer_list<value_type> + + unordered_map& + + Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed. + + + + value_type is CopyInsertable into the container and + CopyAssignable. + + + allocator_type @@ -3467,6 +3512,21 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + + initializer_list<value_type> + + unordered_multimap& + + Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed. + + + + value_type is CopyInsertable into the container and + CopyAssignable. + + + allocator_type From 4b0054813800d42b340cdf179f0b738865b4102d Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 4 Sep 2016 08:07:51 +0100 Subject: [PATCH 3/3] Test+document insertion from initializer lists. --- doc/ref.php | 24 +++++++++ doc/ref.xml | 86 ++++++++++++++++++++++++++++++++ test/unordered/compile_tests.hpp | 3 ++ 3 files changed, 113 insertions(+) diff --git a/doc/ref.php b/doc/ref.php index 0f66d789..1530bd87 100644 --- a/doc/ref.php +++ b/doc/ref.php @@ -673,6 +673,30 @@ EOL; Pointers and references to elements are never invalidated. + + + initializer_list<value_type> + + void + + Inserts a range of elements into the container. + + Elements are inserted if and only if there is no element in the container with an equivalent . + + + + + value_type is EmplaceConstructible into + X from *first. + + + When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. + + + Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. + Pointers and references to elements are never invalidated. + + const_iterator diff --git a/doc/ref.xml b/doc/ref.xml index b0f45726..11e3d8a0 100644 --- a/doc/ref.xml +++ b/doc/ref.xml @@ -568,6 +568,28 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Pointers and references to elements are never invalidated. + + + initializer_list<value_type> + + void + + Inserts a range of elements into the container. + Elements are inserted if and only if there is no element in the container with an equivalent value. + + + + value_type is EmplaceConstructible into + X from *first. + + + When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. + + + Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. + Pointers and references to elements are never invalidated. + + const_iterator @@ -1616,6 +1638,27 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Pointers and references to elements are never invalidated. + + + initializer_list<value_type> + + void + + Inserts a range of elements into the container. + + + + value_type is EmplaceConstructible into + X from *first. + + + When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. + + + Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. + Pointers and references to elements are never invalidated. + + const_iterator @@ -2682,6 +2725,28 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Pointers and references to elements are never invalidated. + + + initializer_list<value_type> + + void + + Inserts a range of elements into the container. + Elements are inserted if and only if there is no element in the container with an equivalent key. + + + + value_type is EmplaceConstructible into + X from *first. + + + When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. + + + Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. + Pointers and references to elements are never invalidated. + + const_iterator @@ -3777,6 +3842,27 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Pointers and references to elements are never invalidated. + + + initializer_list<value_type> + + void + + Inserts a range of elements into the container. + + + + value_type is EmplaceConstructible into + X from *first. + + + When inserting a single element, if an exception is thrown by an operation other than a call to hasher the function has no effect. + + + Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. + Pointers and references to elements are never invalidated. + + const_iterator diff --git a/test/unordered/compile_tests.hpp b/test/unordered/compile_tests.hpp index c83ae41f..e944bf0e 100644 --- a/test/unordered/compile_tests.hpp +++ b/test/unordered/compile_tests.hpp @@ -476,6 +476,9 @@ void unordered_copyable_test(X& x, Key& k, T& t, Hash& hf, Pred& eq) test::check_return_type::equals(a.emplace_hint(q, t)); a.insert(i, j); +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + a.insert({t}); +#endif X a10; a10.insert(t);