From eabe9194b471f17bc76f2f195e554a14b1ae9019 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 16 Jun 2023 03:47:24 -0400 Subject: [PATCH 1/8] [flat.map] P2767R0 section 3 as seen by LWG Modified to resolve the merge conflict with LWG3884 (03da5baa). --- source/containers.tex | 218 ++++++++++++++++++++---------------------- 1 file changed, 106 insertions(+), 112 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index c2d1113887..1a19bb5538 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -15207,87 +15207,89 @@ mapped_container_type values; }; - // \ref{flat.map.cons}, construct/copy/destroy + // \ref{flat.map.cons}, constructors flat_map() : flat_map(key_compare()) { } - template - flat_map(const flat_map&, const Allocator& a); - template - flat_map(flat_map&&, const Allocator& a); - flat_map(key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); - template - flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, - const Allocator& a); - template - flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, - const key_compare& comp, const Allocator& a); flat_map(sorted_unique_t, key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); - template - flat_map(sorted_unique_t, const key_container_type& key_cont, - const mapped_container_type& mapped_cont, const Allocator& a); - template - flat_map(sorted_unique_t, const key_container_type& key_cont, - const mapped_container_type& mapped_cont, - const key_compare& comp, const Allocator& a); explicit flat_map(const key_compare& comp) : c(), compare(comp) { } - template - flat_map(const key_compare& comp, const Allocator& a); - template - explicit flat_map(const Allocator& a); template flat_map(InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : c(), compare(comp) { insert(first, last); } - template - flat_map(InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); - template - flat_map(InputIterator first, InputIterator last, const Allocator& a); template<@\exposconcept{container-compatible-range}@ R> flat_map(from_range_t fr, R&& rg) : flat_map(fr, std::forward(rg), key_compare()) { } - template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_map(from_range_t, R&& rg, const Allocator& a); template<@\exposconcept{container-compatible-range}@ R> flat_map(from_range_t, R&& rg, const key_compare& comp) : flat_map(comp) { insert_range(std::forward(rg)); } - template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_map(from_range_t, R&& rg, const key_compare& comp, const Allocator& a); template flat_map(sorted_unique_t s, InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : c(), compare(comp) { insert(s, first, last); } - template - flat_map(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); - template - flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Allocator& a); flat_map(initializer_list il, const key_compare& comp = key_compare()) : flat_map(il.begin(), il.end(), comp) { } - template - flat_map(initializer_list il, const key_compare& comp, const Allocator& a); - template - flat_map(initializer_list il, const Allocator& a); flat_map(sorted_unique_t s, initializer_list il, const key_compare& comp = key_compare()) : flat_map(s, il.begin(), il.end(), comp) { } - template + + // \ref{flat.map.cons.alloc}, constructors with allocators + + template + flat_map(const flat_map&, const Alloc& a); + template + flat_map(flat_map&&, const Alloc& a); + template + flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, + const Alloc& a); + template + flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, + const key_compare& comp, const Alloc& a); + template + flat_map(sorted_unique_t, const key_container_type& key_cont, + const mapped_container_type& mapped_cont, const Alloc& a); + template + flat_map(sorted_unique_t, const key_container_type& key_cont, + const mapped_container_type& mapped_cont, + const key_compare& comp, const Alloc& a); + template + flat_map(const key_compare& comp, const Alloc& a); + template + explicit flat_map(const Alloc& a); + template + flat_map(InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); + template + flat_map(InputIterator first, InputIterator last, const Alloc& a); + template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_map(from_range_t, R&& rg, const Alloc& a); + template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_map(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); + template + flat_map(sorted_unique_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); + template + flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); + template + flat_map(initializer_list il, const key_compare& comp, const Alloc& a); + template + flat_map(initializer_list il, const Alloc& a); + template flat_map(sorted_unique_t, initializer_list il, - const key_compare& comp, const Allocator& a); - template - flat_map(sorted_unique_t, initializer_list il, const Allocator& a); + const key_compare& comp, const Alloc& a); + template + flat_map(sorted_unique_t, initializer_list il, const Alloc& a); - flat_map& operator=(initializer_list il); + flat_map& operator=(initializer_list); // iterators iterator begin() noexcept; @@ -15546,69 +15548,66 @@ \indexlibraryctor{flat_map}% \begin{itemdecl} -template - flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, - const Allocator& a); -template - flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, - const key_compare& comp, const Allocator& a); +flat_map(sorted_unique_t, key_container_type key_cont, mapped_container_type mapped_cont, + const key_compare& comp = key_compare()); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true} and -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects -Equivalent to \tcode{flat_map(key_cont, mapped_cont)} and -\tcode{flat_map(key_cont, mapped_cont, comp)}, respectively, -except that \tcode{c.keys} and \tcode{c.values} are constructed with -uses-allocator construction\iref{allocator.uses.construction}. +Initializes +\tcode{c.keys} with \tcode{std::move(key_cont)}, +\tcode{c.values} with \tcode{std::move(mapped_cont)}, and +\tcode{compare} with \tcode{comp}. \pnum \complexity -Same as \tcode{flat_map(key_cont, mapped_cont)} and -\tcode{flat_map(key_cont, mapped_cont, comp)}, respectively. +Constant. \end{itemdescr} +\rSec3[flat.map.cons.alloc]{Constructors with allocators} + +\pnum +The constructors in this subclause shall not participate in overload resolution +unless \tcode{uses_allocator_v} is \tcode{true} +and \tcode{uses_allocator_v} is \tcode{true}. + \indexlibraryctor{flat_map}% \begin{itemdecl} -flat_map(sorted_unique_t, key_container_type key_cont, mapped_container_type mapped_cont, - const key_compare& comp = key_compare()); +template + flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, + const Alloc& a); +template + flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, + const key_compare& comp, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum \effects -Initializes -\tcode{c.keys} with \tcode{std::move(key_cont)}, -\tcode{c.values} with \tcode{std::move(mapped_cont)}, and -\tcode{compare} with \tcode{comp}. +Equivalent to \tcode{flat_map(key_cont, mapped_cont)} and +\tcode{flat_map(key_cont, mapped_cont, comp)}, respectively, +except that \tcode{c.keys} and \tcode{c.values} are constructed with +uses-allocator construction\iref{allocator.uses.construction}. \pnum \complexity -Constant. +Same as \tcode{flat_map(key_cont, mapped_cont)} and +\tcode{flat_map(key_cont, mapped_cont, comp)}, respectively. \end{itemdescr} \indexlibraryctor{flat_map}% \begin{itemdecl} -template +template flat_map(sorted_unique_t s, const key_container_type& key_cont, - const mapped_container_type& mapped_cont, const Allocator& a); -template + const mapped_container_type& mapped_cont, const Alloc& a); +template flat_map(sorted_unique_t s, const key_container_type& key_cont, const mapped_container_type& mapped_cont, const key_compare& comp, - const Allocator& a); + const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true} and -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to \tcode{flat_map(s, key_cont, mapped_cont)} and @@ -15623,44 +15622,39 @@ \indexlibraryctor{flat_map}% \begin{itemdecl} -template - flat_map(const flat_map&, const Allocator& a); -template - flat_map(flat_map&&, const Allocator& a); -template - flat_map(const key_compare& comp, const Allocator& a); -template - explicit flat_map(const Allocator& a); -template - flat_map(InputIterator first, InputIterator last, const key_compare& comp, const Allocator& a); -template - flat_map(InputIterator first, InputIterator last, const Allocator& a); -template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_map(from_range_t, R&& rg, const Allocator& a); -template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_map(from_range_t, R&& rg, const key_compare& comp, const Allocator& a); -template +template + flat_map(const flat_map&, const Alloc& a); +template + flat_map(flat_map&&, const Alloc& a); +template + flat_map(const key_compare& comp, const Alloc& a); +template + explicit flat_map(const Alloc& a); +template + flat_map(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); +template + flat_map(InputIterator first, InputIterator last, const Alloc& a); +template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_map(from_range_t, R&& rg, const Alloc& a); +template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_map(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); +template flat_map(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); -template - flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Allocator& a); -template - flat_map(initializer_list il, const key_compare& comp, const Allocator& a); -template - flat_map(initializer_list il, const Allocator& a); -template + const key_compare& comp, const Alloc& a); +template + flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_map(initializer_list il, const key_compare& comp, const Alloc& a); +template + flat_map(initializer_list il, const Alloc& a); +template flat_map(sorted_unique_t, initializer_list il, - const key_compare& comp, const Allocator& a); -template - flat_map(sorted_unique_t, initializer_list il, const Allocator& a); + const key_compare& comp, const Alloc& a); +template + flat_map(sorted_unique_t, initializer_list il, const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true} and -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to the corresponding non-allocator constructors From 86f9187da00162b7113869fe229117d051f2ee3f Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 16 Jun 2023 03:52:47 -0400 Subject: [PATCH 2/8] [flat.map] P2767R0 section 3 swaps requested by jwakely in LWG Swap the default ctor to the top. Follow each non-`key_compare` overload by its `key_compare` counterpart. Then, follow each non-`sorted_unique` pair of overloads by its `sorted_unique` counterparts. --- source/containers.tex | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 1a19bb5538..9c99652a9e 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -15210,19 +15210,24 @@ // \ref{flat.map.cons}, constructors flat_map() : flat_map(key_compare()) { } + explicit flat_map(const key_compare& comp) + : c(), compare(comp) { } + flat_map(key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); flat_map(sorted_unique_t, key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); - explicit flat_map(const key_compare& comp) - : c(), compare(comp) { } - template flat_map(InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : c(), compare(comp) { insert(first, last); } + template + flat_map(sorted_unique_t s, InputIterator first, InputIterator last, + const key_compare& comp = key_compare()) + : c(), compare(comp) { insert(s, first, last); } + template<@\exposconcept{container-compatible-range}@ R> flat_map(from_range_t fr, R&& rg) : flat_map(fr, std::forward(rg), key_compare()) { } @@ -15230,11 +15235,6 @@ flat_map(from_range_t, R&& rg, const key_compare& comp) : flat_map(comp) { insert_range(std::forward(rg)); } - template - flat_map(sorted_unique_t s, InputIterator first, InputIterator last, - const key_compare& comp = key_compare()) - : c(), compare(comp) { insert(s, first, last); } - flat_map(initializer_list il, const key_compare& comp = key_compare()) : flat_map(il.begin(), il.end(), comp) { } @@ -15245,9 +15245,9 @@ // \ref{flat.map.cons.alloc}, constructors with allocators template - flat_map(const flat_map&, const Alloc& a); + explicit flat_map(const Alloc& a); template - flat_map(flat_map&&, const Alloc& a); + flat_map(const key_compare& comp, const Alloc& a); template flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont, const Alloc& a); @@ -15262,32 +15262,32 @@ const mapped_container_type& mapped_cont, const key_compare& comp, const Alloc& a); template - flat_map(const key_compare& comp, const Alloc& a); + flat_map(const flat_map&, const Alloc& a); template - explicit flat_map(const Alloc& a); + flat_map(flat_map&&, const Alloc& a); + template + flat_map(InputIterator first, InputIterator last, const Alloc& a); template flat_map(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); template - flat_map(InputIterator first, InputIterator last, const Alloc& a); + flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); + template + flat_map(sorted_unique_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_map(from_range_t, R&& rg, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_map(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); - template - flat_map(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp, const Alloc& a); - template - flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); + template + flat_map(initializer_list il, const Alloc& a); template flat_map(initializer_list il, const key_compare& comp, const Alloc& a); template - flat_map(initializer_list il, const Alloc& a); + flat_map(sorted_unique_t, initializer_list il, const Alloc& a); template flat_map(sorted_unique_t, initializer_list il, const key_compare& comp, const Alloc& a); - template - flat_map(sorted_unique_t, initializer_list il, const Alloc& a); flat_map& operator=(initializer_list); @@ -15623,35 +15623,35 @@ \indexlibraryctor{flat_map}% \begin{itemdecl} template - flat_map(const flat_map&, const Alloc& a); -template - flat_map(flat_map&&, const Alloc& a); + explicit flat_map(const Alloc& a); template flat_map(const key_compare& comp, const Alloc& a); template - explicit flat_map(const Alloc& a); + flat_map(const flat_map&, const Alloc& a); +template + flat_map(flat_map&&, const Alloc& a); +template + flat_map(InputIterator first, InputIterator last, const Alloc& a); template flat_map(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); template - flat_map(InputIterator first, InputIterator last, const Alloc& a); + flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_map(sorted_unique_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_map(from_range_t, R&& rg, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_map(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); -template - flat_map(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp, const Alloc& a); -template - flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_map(initializer_list il, const Alloc& a); template flat_map(initializer_list il, const key_compare& comp, const Alloc& a); template - flat_map(initializer_list il, const Alloc& a); + flat_map(sorted_unique_t, initializer_list il, const Alloc& a); template flat_map(sorted_unique_t, initializer_list il, const key_compare& comp, const Alloc& a); -template - flat_map(sorted_unique_t, initializer_list il, const Alloc& a); \end{itemdecl} \begin{itemdescr} From dd6c2cdb1a610f5b6d2d3d109c49752d02937498 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 16 Jun 2023 04:07:06 -0400 Subject: [PATCH 3/8] [flat.multimap] P2767R0 section 3 as seen by LWG Modified to resolve the merge conflict with LWG3884 (03da5baa). --- source/containers.tex | 222 ++++++++++++++++++++---------------------- 1 file changed, 108 insertions(+), 114 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 9c99652a9e..07ded29d8d 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -16390,92 +16390,94 @@ mapped_container_type values; }; - // \ref{flat.multimap.cons}, construct/copy/destroy + // \ref{flat.multimap.cons}, constructors flat_multimap() : flat_multimap(key_compare()) { } - template - flat_multimap(const flat_multimap&, const Allocator& a); - template - flat_multimap(flat_multimap&&, const Allocator& a); - flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); - template - flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, - const Allocator& a); - template - flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, - const key_compare& comp, const Allocator& a); flat_multimap(sorted_equivalent_t, key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); - template - flat_multimap(sorted_equivalent_t, const key_container_type& key_cont, - const mapped_container_type& mapped_cont, const Allocator& a); - template - flat_multimap(sorted_equivalent_t, const key_container_type& key_cont, - const mapped_container_type& mapped_cont, - const key_compare& comp, const Allocator& a); explicit flat_multimap(const key_compare& comp) : c(), compare(comp) { } - template - flat_multimap(const key_compare& comp, const Allocator& a); - template - explicit flat_multimap(const Allocator& a); template flat_multimap(InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : c(), compare(comp) { insert(first, last); } - template - flat_multimap(InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); - template - flat_multimap(InputIterator first, InputIterator last, const Allocator& a); template<@\exposconcept{container-compatible-range}@ R> flat_multimap(from_range_t fr, R&& rg) : flat_multimap(fr, std::forward(rg), key_compare()) { } - template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_multimap(from_range_t, R&& rg, const Allocator& a); template<@\exposconcept{container-compatible-range}@ R> flat_multimap(from_range_t, R&& rg, const key_compare& comp) : flat_multimap(comp) { insert_range(std::forward(rg)); } - template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Allocator& a); template flat_multimap(sorted_equivalent_t s, InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : c(), compare(comp) { insert(s, first, last); } - template - flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); - template - flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, - const Allocator& a); flat_multimap(initializer_list il, const key_compare& comp = key_compare()) : flat_multimap(il.begin(), il.end(), comp) { } - template - flat_multimap(initializer_list il, const key_compare& comp, - const Allocator& a); - template - flat_multimap(initializer_list il, const Allocator& a); flat_multimap(sorted_equivalent_t s, initializer_list il, const key_compare& comp = key_compare()) : flat_multimap(s, il.begin(), il.end(), comp) { } - template + + // \ref{flat.multimap.cons.alloc}, constructors with allocators + + template + flat_multimap(const flat_multimap&, const Alloc& a); + template + flat_multimap(flat_multimap&&, const Alloc& a); + template + flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, + const Alloc& a); + template + flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, + const key_compare& comp, const Alloc& a); + template + flat_multimap(sorted_equivalent_t, const key_container_type& key_cont, + const mapped_container_type& mapped_cont, const Alloc& a); + template + flat_multimap(sorted_equivalent_t, const key_container_type& key_cont, + const mapped_container_type& mapped_cont, + const key_compare& comp, const Alloc& a); + template + flat_multimap(const key_compare& comp, const Alloc& a); + template + explicit flat_multimap(const Alloc& a); + template + flat_multimap(InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); + template + flat_multimap(InputIterator first, InputIterator last, const Alloc& a); + template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_multimap(from_range_t, R&& rg, const Alloc& a); + template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); + template + flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); + template + flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, + const Alloc& a); + template + flat_multimap(initializer_list il, const key_compare& comp, + const Alloc& a); + template + flat_multimap(initializer_list il, const Alloc& a); + template flat_multimap(sorted_equivalent_t, initializer_list il, - const key_compare& comp, const Allocator& a); - template - flat_multimap(sorted_equivalent_t, initializer_list il, const Allocator& a); + const key_compare& comp, const Alloc& a); + template + flat_multimap(sorted_equivalent_t, initializer_list il, const Alloc& a); - flat_multimap& operator=(initializer_list il); + flat_multimap& operator=(initializer_list); // iterators iterator begin() noexcept; @@ -16691,69 +16693,66 @@ \indexlibraryctor{flat_multimap}% \begin{itemdecl} -template - flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, - const Allocator& a); -template - flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, - const key_compare& comp, const Allocator& a); +flat_multimap(sorted_equivalent_t, key_container_type key_cont, mapped_container_type mapped_cont, + const key_compare& comp = key_compare()); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true} and -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects -Equivalent to \tcode{flat_multimap(key_cont, mapped_cont)} and -\tcode{flat_multimap(key_cont, \linebreak{}mapped_cont, comp)}, respectively, -except that \tcode{c.keys} and \tcode{c.values} are constructed -with uses-allocator construction\iref{allocator.uses.construction}. +Initializes +\tcode{c.keys} with \tcode{std::move(key_cont)}, +\tcode{c.values} with \tcode{std::move(mapped_cont)}, and +\tcode{compare} with \tcode{comp}. \pnum \complexity -Same as \tcode{flat_multimap(key_cont, mapped_cont)} and -\tcode{flat_multimap(key_cont, \linebreak{}mapped_cont, comp)}, respectively. +Constant. \end{itemdescr} +\rSec3[flat.multimap.cons.alloc]{Constructors with allocators} + +\pnum +The constructors in this subclause shall not participate in overload resolution +unless \tcode{uses_allocator_v} is \tcode{true} +and \tcode{uses_allocator_v} is \tcode{true}. + \indexlibraryctor{flat_multimap}% \begin{itemdecl} -flat_multimap(sorted_equivalent_t, key_container_type key_cont, mapped_container_type mapped_cont, - const key_compare& comp = key_compare()); +template + flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, + const Alloc& a); +template + flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, + const key_compare& comp, const Alloc& a); \end{itemdecl} \begin{itemdescr} \pnum \effects -Initializes -\tcode{c.keys} with \tcode{std::move(key_cont)}, -\tcode{c.values} with \tcode{std::move(mapped_cont)}, and -\tcode{compare} with \tcode{comp}. +Equivalent to \tcode{flat_multimap(key_cont, mapped_cont)} and +\tcode{flat_multimap(key_cont, \linebreak{}mapped_cont, comp)}, respectively, +except that \tcode{c.keys} and \tcode{c.values} are constructed +with uses-allocator construction\iref{allocator.uses.construction}. \pnum \complexity -Constant. +Same as \tcode{flat_multimap(key_cont, mapped_cont)} and +\tcode{flat_multimap(key_cont, \linebreak{}mapped_cont, comp)}, respectively. \end{itemdescr} \indexlibraryctor{flat_multimap}% \begin{itemdecl} -template +template flat_multimap(sorted_equivalent_t s, const key_container_type& key_cont, - const mapped_container_type& mapped_cont, const Allocator& a); -template + const mapped_container_type& mapped_cont, const Alloc& a); +template flat_multimap(sorted_equivalent_t s, const key_container_type& key_cont, const mapped_container_type& mapped_cont, const key_compare& comp, - const Allocator& a); + const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true} and -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to \tcode{flat_multimap(s, key_cont, mapped_cont)} and @@ -16768,46 +16767,41 @@ \indexlibraryctor{flat_multimap}% \begin{itemdecl} -template - flat_multimap(const flat_multimap&, const Allocator& a); -template - flat_multimap(flat_multimap&&, const Allocator& a); -template - flat_multimap(const key_compare& comp, const Allocator& a); -template - explicit flat_multimap(const Allocator& a); -template +template + flat_multimap(const flat_multimap&, const Alloc& a); +template + flat_multimap(flat_multimap&&, const Alloc& a); +template + flat_multimap(const key_compare& comp, const Alloc& a); +template + explicit flat_multimap(const Alloc& a); +template flat_multimap(InputIterator first, InputIterator last, const key_compare& comp, - const Allocator& a); -template - flat_multimap(InputIterator first, InputIterator last, const Allocator& a); -template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_multimap(from_range_t, R&& rg, const Allocator& a); -template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Allocator& a); -template + const Alloc& a); +template + flat_multimap(InputIterator first, InputIterator last, const Alloc& a); +template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_multimap(from_range_t, R&& rg, const Alloc& a); +template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); +template flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); -template + const key_compare& comp, const Alloc& a); +template flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, - const Allocator& a); -template - flat_multimap(initializer_list il, const key_compare& comp, const Allocator& a); -template - flat_multimap(initializer_list il, const Allocator& a); -template + const Alloc& a); +template + flat_multimap(initializer_list il, const key_compare& comp, const Alloc& a); +template + flat_multimap(initializer_list il, const Alloc& a); +template flat_multimap(sorted_equivalent_t, initializer_list il, - const key_compare& comp, const Allocator& a); -template - flat_multimap(sorted_equivalent_t, initializer_list il, const Allocator& a); + const key_compare& comp, const Alloc& a); +template + flat_multimap(sorted_equivalent_t, initializer_list il, const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true} and -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to the corresponding non-allocator constructors From f0a5f028b93977cc2da4487fd4a5714cb671361b Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 16 Jun 2023 04:10:21 -0400 Subject: [PATCH 4/8] [flat.multimap] P2767R0 section 3 swaps requested by jwakely in LWG Swap the default ctor to the top. Follow each non-`key_compare` overload by its `key_compare` counterpart. Then, follow each non-`sorted_unique` pair of overloads by its `sorted_unique` counterparts. --- source/containers.tex | 72 +++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 07ded29d8d..3d4848477e 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -16393,6 +16393,9 @@ // \ref{flat.multimap.cons}, constructors flat_multimap() : flat_multimap(key_compare()) { } + explicit flat_multimap(const key_compare& comp) + : c(), compare(comp) { } + flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); @@ -16400,15 +16403,17 @@ key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare()); - explicit flat_multimap(const key_compare& comp) - : c(), compare(comp) { } - template flat_multimap(InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : c(), compare(comp) { insert(first, last); } + template + flat_multimap(sorted_equivalent_t s, InputIterator first, InputIterator last, + const key_compare& comp = key_compare()) + : c(), compare(comp) { insert(s, first, last); } + template<@\exposconcept{container-compatible-range}@ R> flat_multimap(from_range_t fr, R&& rg) : flat_multimap(fr, std::forward(rg), key_compare()) { } @@ -16416,11 +16421,6 @@ flat_multimap(from_range_t, R&& rg, const key_compare& comp) : flat_multimap(comp) { insert_range(std::forward(rg)); } - template - flat_multimap(sorted_equivalent_t s, InputIterator first, InputIterator last, - const key_compare& comp = key_compare()) - : c(), compare(comp) { insert(s, first, last); } - flat_multimap(initializer_list il, const key_compare& comp = key_compare()) : flat_multimap(il.begin(), il.end(), comp) { } @@ -16431,9 +16431,9 @@ // \ref{flat.multimap.cons.alloc}, constructors with allocators template - flat_multimap(const flat_multimap&, const Alloc& a); + explicit flat_multimap(const Alloc& a); template - flat_multimap(flat_multimap&&, const Alloc& a); + flat_multimap(const key_compare& comp, const Alloc& a); template flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont, const Alloc& a); @@ -16448,34 +16448,34 @@ const mapped_container_type& mapped_cont, const key_compare& comp, const Alloc& a); template - flat_multimap(const key_compare& comp, const Alloc& a); + flat_multimap(const flat_multimap&, const Alloc& a); template - explicit flat_multimap(const Alloc& a); + flat_multimap(flat_multimap&&, const Alloc& a); + template + flat_multimap(InputIterator first, InputIterator last, const Alloc& a); template flat_multimap(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); template - flat_multimap(InputIterator first, InputIterator last, const Alloc& a); + flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, + const Alloc& a); + template + flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_multimap(from_range_t, R&& rg, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); - template - flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp, const Alloc& a); - template - flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, - const Alloc& a); + template + flat_multimap(initializer_list il, const Alloc& a); template flat_multimap(initializer_list il, const key_compare& comp, const Alloc& a); template - flat_multimap(initializer_list il, const Alloc& a); + flat_multimap(sorted_equivalent_t, initializer_list il, const Alloc& a); template flat_multimap(sorted_equivalent_t, initializer_list il, const key_compare& comp, const Alloc& a); - template - flat_multimap(sorted_equivalent_t, initializer_list il, const Alloc& a); flat_multimap& operator=(initializer_list); @@ -16768,37 +16768,37 @@ \indexlibraryctor{flat_multimap}% \begin{itemdecl} template - flat_multimap(const flat_multimap&, const Alloc& a); -template - flat_multimap(flat_multimap&&, const Alloc& a); + explicit flat_multimap(const Alloc& a); template flat_multimap(const key_compare& comp, const Alloc& a); template - explicit flat_multimap(const Alloc& a); + flat_multimap(const flat_multimap&, const Alloc& a); +template + flat_multimap(flat_multimap&&, const Alloc& a); +template + flat_multimap(InputIterator first, InputIterator last, const Alloc& a); template flat_multimap(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); template - flat_multimap(InputIterator first, InputIterator last, const Alloc& a); + flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, + const Alloc& a); +template + flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_multimap(from_range_t, R&& rg, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); -template - flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp, const Alloc& a); -template - flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last, - const Alloc& a); +template + flat_multimap(initializer_list il, const Alloc& a); template flat_multimap(initializer_list il, const key_compare& comp, const Alloc& a); template - flat_multimap(initializer_list il, const Alloc& a); + flat_multimap(sorted_equivalent_t, initializer_list il, const Alloc& a); template flat_multimap(sorted_equivalent_t, initializer_list il, const key_compare& comp, const Alloc& a); -template - flat_multimap(sorted_equivalent_t, initializer_list il, const Alloc& a); \end{itemdecl} \begin{itemdescr} From b2aa109aa613d756355a91a97083640980c77c0b Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 16 Jun 2023 05:35:21 -0400 Subject: [PATCH 5/8] [flat.multiset] P2767R0 section 3 as seen by LWG Modified to resolve the merge conflict with LWG3884 (03da5baa). --- source/containers.tex | 178 +++++++++++++++++++++--------------------- 1 file changed, 87 insertions(+), 91 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 3d4848477e..63b81fc31f 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -17620,83 +17620,85 @@ // \ref{flat.multiset.cons}, constructors flat_multiset() : flat_multiset(key_compare()) { } - template - flat_multiset(const flat_multiset&, const Allocator& a); - template - flat_multiset(flat_multiset&&, const Allocator& a); - explicit flat_multiset(container_type cont, const key_compare& comp = key_compare()); - template - flat_multiset(const container_type& cont, const Allocator& a); - template - flat_multiset(const container_type& cont, const key_compare& comp, const Allocator& a); flat_multiset(sorted_equivalent_t, container_type cont, const key_compare& comp = key_compare()) : @\exposid{c}@(std::move(cont)), @\exposid{compare}@(comp) { } - template - flat_multiset(sorted_equivalent_t, const container_type& cont, const Allocator& a); - template - flat_multiset(sorted_equivalent_t, const container_type& cont, - const key_compare& comp, const Allocator& a); explicit flat_multiset(const key_compare& comp) : @\exposid{c}@(), @\exposid{compare}@(comp) { } - template - flat_multiset(const key_compare& comp, const Allocator& a); - template - explicit flat_multiset(const Allocator& a); template flat_multiset(InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : @\exposid{c}@(), @\exposid{compare}@(comp) { insert(first, last); } - template - flat_multiset(InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); - template - flat_multiset(InputIterator first, InputIterator last, const Allocator& a); template<@\exposconcept{container-compatible-range}@ R> flat_multiset(from_range_t fr, R&& rg) : flat_multiset(fr, std::forward(rg), key_compare()) { } - template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_multiset(from_range_t, R&& rg, const Allocator& a); template<@\exposconcept{container-compatible-range}@ R> flat_multiset(from_range_t, R&& rg, const key_compare& comp) : flat_multiset(comp) { insert_range(std::forward(rg)); } - template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Allocator& a); template flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : @\exposid{c}@(first, last), @\exposid{compare}@(comp) { } - template - flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); - template - flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, - const Allocator& a); flat_multiset(initializer_list il, const key_compare& comp = key_compare()) : flat_multiset(il.begin(), il.end(), comp) { } - template - flat_multiset(initializer_list il, const key_compare& comp, - const Allocator& a); - template - flat_multiset(initializer_list il, const Allocator& a); flat_multiset(sorted_equivalent_t s, initializer_list il, const key_compare& comp = key_compare()) : flat_multiset(s, il.begin(), il.end(), comp) { } - template + + // \ref{flat.multiset.cons.alloc}, constructors with allocators + + template + flat_multiset(const flat_multiset&, const Alloc& a); + template + flat_multiset(flat_multiset&&, const Alloc& a); + template + flat_multiset(const container_type& cont, const Alloc& a); + template + flat_multiset(const container_type& cont, const key_compare& comp, const Alloc& a); + template + flat_multiset(sorted_equivalent_t, const container_type& cont, const Alloc& a); + template + flat_multiset(sorted_equivalent_t, const container_type& cont, + const key_compare& comp, const Alloc& a); + template + flat_multiset(const key_compare& comp, const Alloc& a); + template + explicit flat_multiset(const Alloc& a); + template + flat_multiset(InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); + template + flat_multiset(InputIterator first, InputIterator last, const Alloc& a); + template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_multiset(from_range_t, R&& rg, const Alloc& a); + template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); + template + flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); + template + flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, + const Alloc& a); + template + flat_multiset(initializer_list il, const key_compare& comp, + const Alloc& a); + template + flat_multiset(initializer_list il, const Alloc& a); + template flat_multiset(sorted_equivalent_t, initializer_list il, - const key_compare& comp, const Allocator& a); - template - flat_multiset(sorted_equivalent_t, initializer_list il, const Allocator& a); + const key_compare& comp, const Alloc& a); + template + flat_multiset(sorted_equivalent_t, initializer_list il, const Alloc& a); flat_multiset& operator=(initializer_list); @@ -17878,23 +17880,25 @@ \pnum \complexity -Linear in $N$ if \tcode{cont} is sorted with respect to \exposid{compare} and +Linear in $N$ if \tcode{cont} is already sorted with respect to \exposid{compare} and otherwise $N \log N$, where $N$ is the value of \tcode{cont.size()} before this call. \end{itemdescr} +\rSec3[flat.multiset.cons.alloc]{Constructors with allocators} + +\pnum +The constructors in this subclause shall not participate in overload resolution +unless \tcode{uses_allocator_v} is \tcode{true}. + \indexlibraryctor{flat_multiset}% \begin{itemdecl} -template - flat_multiset(const container_type& cont, const Allocator& a); -template - flat_multiset(const container_type& cont, const key_compare& comp, const Allocator& a); +template + flat_multiset(const container_type& cont, const Alloc& a); +template + flat_multiset(const container_type& cont, const key_compare& comp, const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to \tcode{flat_multiset(cont)} and @@ -17910,18 +17914,14 @@ \indexlibraryctor{flat_multiset}% \begin{itemdecl} -template - flat_multiset(sorted_equivalent_t s, const container_type& cont, const Allocator& a); -template +template + flat_multiset(sorted_equivalent_t s, const container_type& cont, const Alloc& a); +template flat_multiset(sorted_equivalent_t s, const container_type& cont, - const key_compare& comp, const Allocator& a); + const key_compare& comp, const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to \tcode{flat_multiset(s, cont)} and @@ -17936,44 +17936,40 @@ \indexlibraryctor{flat_multiset}% \begin{itemdecl} -template - flat_multiset(const flat_multiset&, const Allocator& a); -template - flat_multiset(flat_multiset&&, const Allocator& a); -template - flat_multiset(const key_compare& comp, const Allocator& a); -template - explicit flat_multiset(const Allocator& a); -template +template + flat_multiset(const flat_multiset&, const Alloc& a); +template + flat_multiset(flat_multiset&&, const Alloc& a); +template + flat_multiset(const key_compare& comp, const Alloc& a); +template + explicit flat_multiset(const Alloc& a); +template flat_multiset(InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); -template - flat_multiset(InputIterator first, InputIterator last, const Allocator& a); -template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_multiset(from_range_t, R&& rg, const Allocator& a); -template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Allocator& a); -template + const key_compare& comp, const Alloc& a); +template + flat_multiset(InputIterator first, InputIterator last, const Alloc& a); +template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_multiset(from_range_t, R&& rg, const Alloc& a); +template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); +template flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); -template - flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, const Allocator& a); -template - flat_multiset(initializer_list il, const key_compare& comp, const Allocator& a); -template - flat_multiset(initializer_list il, const Allocator& a); -template + const key_compare& comp, const Alloc& a); +template + flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_multiset(initializer_list il, const key_compare& comp, const Alloc& a); +template + flat_multiset(initializer_list il, const Alloc& a); +template flat_multiset(sorted_equivalent_t, initializer_list il, - const key_compare& comp, const Allocator& a); -template - flat_multiset(sorted_equivalent_t, initializer_list il, const Allocator& a); + const key_compare& comp, const Alloc& a); +template + flat_multiset(sorted_equivalent_t, initializer_list il, const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to the corresponding non-allocator constructors From 291523d2946c58e4dee71c45249d61dce6b7fb77 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 16 Jun 2023 05:39:03 -0400 Subject: [PATCH 6/8] [flat.multiset] P2767R0 section 3 swaps requested by jwakely in LWG Swap the default ctor to the top. Follow each non-`key_compare` overload by its `key_compare` counterpart. Then, follow each non-`sorted_unique` pair of overloads by its `sorted_unique` counterparts. --- source/containers.tex | 70 +++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 63b81fc31f..e9561c92f5 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -17620,21 +17620,26 @@ // \ref{flat.multiset.cons}, constructors flat_multiset() : flat_multiset(key_compare()) { } + explicit flat_multiset(const key_compare& comp) + : @\exposid{c}@(), @\exposid{compare}@(comp) { } + explicit flat_multiset(container_type cont, const key_compare& comp = key_compare()); flat_multiset(sorted_equivalent_t, container_type cont, const key_compare& comp = key_compare()) : @\exposid{c}@(std::move(cont)), @\exposid{compare}@(comp) { } - explicit flat_multiset(const key_compare& comp) - : @\exposid{c}@(), @\exposid{compare}@(comp) { } - template flat_multiset(InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : @\exposid{c}@(), @\exposid{compare}@(comp) { insert(first, last); } + template + flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, + const key_compare& comp = key_compare()) + : @\exposid{c}@(first, last), @\exposid{compare}@(comp) { } + template<@\exposconcept{container-compatible-range}@ R> flat_multiset(from_range_t fr, R&& rg) : flat_multiset(fr, std::forward(rg), key_compare()) { } @@ -17643,11 +17648,6 @@ : flat_multiset(comp) { insert_range(std::forward(rg)); } - template - flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp = key_compare()) - : @\exposid{c}@(first, last), @\exposid{compare}@(comp) { } - flat_multiset(initializer_list il, const key_compare& comp = key_compare()) : flat_multiset(il.begin(), il.end(), comp) { } @@ -17658,9 +17658,9 @@ // \ref{flat.multiset.cons.alloc}, constructors with allocators template - flat_multiset(const flat_multiset&, const Alloc& a); + explicit flat_multiset(const Alloc& a); template - flat_multiset(flat_multiset&&, const Alloc& a); + flat_multiset(const key_compare& comp, const Alloc& a); template flat_multiset(const container_type& cont, const Alloc& a); template @@ -17671,34 +17671,34 @@ flat_multiset(sorted_equivalent_t, const container_type& cont, const key_compare& comp, const Alloc& a); template - flat_multiset(const key_compare& comp, const Alloc& a); + flat_multiset(const flat_multiset&, const Alloc& a); template - explicit flat_multiset(const Alloc& a); + flat_multiset(flat_multiset&&, const Alloc& a); + template + flat_multiset(InputIterator first, InputIterator last, const Alloc& a); template flat_multiset(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); template - flat_multiset(InputIterator first, InputIterator last, const Alloc& a); + flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, + const Alloc& a); + template + flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_multiset(from_range_t, R&& rg, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); - template - flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp, const Alloc& a); - template - flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, - const Alloc& a); + template + flat_multiset(initializer_list il, const Alloc& a); template flat_multiset(initializer_list il, const key_compare& comp, const Alloc& a); template - flat_multiset(initializer_list il, const Alloc& a); + flat_multiset(sorted_equivalent_t, initializer_list il, const Alloc& a); template flat_multiset(sorted_equivalent_t, initializer_list il, const key_compare& comp, const Alloc& a); - template - flat_multiset(sorted_equivalent_t, initializer_list il, const Alloc& a); flat_multiset& operator=(initializer_list); @@ -17937,36 +17937,36 @@ \indexlibraryctor{flat_multiset}% \begin{itemdecl} template - flat_multiset(const flat_multiset&, const Alloc& a); -template - flat_multiset(flat_multiset&&, const Alloc& a); + explicit flat_multiset(const Alloc& a); template flat_multiset(const key_compare& comp, const Alloc& a); template - explicit flat_multiset(const Alloc& a); + flat_multiset(const flat_multiset&, const Alloc& a); +template + flat_multiset(flat_multiset&&, const Alloc& a); +template + flat_multiset(InputIterator first, InputIterator last, const Alloc& a); template flat_multiset(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); template - flat_multiset(InputIterator first, InputIterator last, const Alloc& a); + flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_multiset(from_range_t, R&& rg, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); -template - flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, - const key_compare& comp, const Alloc& a); -template - flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_multiset(initializer_list il, const Alloc& a); template flat_multiset(initializer_list il, const key_compare& comp, const Alloc& a); template - flat_multiset(initializer_list il, const Alloc& a); + flat_multiset(sorted_equivalent_t, initializer_list il, const Alloc& a); template flat_multiset(sorted_equivalent_t, initializer_list il, const key_compare& comp, const Alloc& a); -template - flat_multiset(sorted_equivalent_t, initializer_list il, const Alloc& a); \end{itemdecl} \begin{itemdescr} From 54f94371414d30bd2b00e02b9bb6a0e74177d261 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 16 Jun 2023 05:45:21 -0400 Subject: [PATCH 7/8] [flat.set] P2767R0 section 3 as seen by LWG Modified to resolve the merge conflict with LWG3884 (03da5baa). --- source/containers.tex | 174 +++++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 89 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index e9561c92f5..566c201be1 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -16957,79 +16957,81 @@ // \ref{flat.set.cons}, constructors flat_set() : flat_set(key_compare()) { } - template - flat_set(const flat_set&, const Allocator& a); - template - flat_set(flat_set&&, const Allocator& a); - explicit flat_set(container_type cont, const key_compare& comp = key_compare()); - template - flat_set(const container_type& cont, const Allocator& a); - template - flat_set(const container_type& cont, const key_compare& comp, const Allocator& a); flat_set(sorted_unique_t, container_type cont, const key_compare& comp = key_compare()) : @\exposid{c}@(std::move(cont)), @\exposid{compare}@(comp) { } - template - flat_set(sorted_unique_t, const container_type& cont, const Allocator& a); - template - flat_set(sorted_unique_t, const container_type& cont, - const key_compare& comp, const Allocator& a); explicit flat_set(const key_compare& comp) : @\exposid{c}@(), @\exposid{compare}@(comp) { } - template - flat_set(const key_compare& comp, const Allocator& a); - template - explicit flat_set(const Allocator& a); template flat_set(InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : @\exposid{c}@(), @\exposid{compare}@(comp) { insert(first, last); } - template - flat_set(InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); - template - flat_set(InputIterator first, InputIterator last, const Allocator& a); template<@\exposconcept{container-compatible-range}@ R> flat_set(from_range_t fr, R&& rg) : flat_set(fr, std::forward(rg), key_compare()) { } - template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_set(from_range_t, R&& rg, const Allocator& a); template<@\exposconcept{container-compatible-range}@ R> flat_set(from_range_t, R&& rg, const key_compare& comp) : flat_set(comp) { insert_range(std::forward(rg)); } - template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_set(from_range_t, R&& rg, const key_compare& comp, const Allocator& a); template flat_set(sorted_unique_t, InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : @\exposid{c}@(first, last), @\exposid{compare}@(comp) { } - template - flat_set(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); - template - flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Allocator& a); flat_set(initializer_list il, const key_compare& comp = key_compare()) : flat_set(il.begin(), il.end(), comp) { } - template - flat_set(initializer_list il, const key_compare& comp, const Allocator& a); - template - flat_set(initializer_list il, const Allocator& a); flat_set(sorted_unique_t s, initializer_list il, const key_compare& comp = key_compare()) : flat_set(s, il.begin(), il.end(), comp) { } - template + + // \ref{flat.set.cons.alloc}, constructors with allocators + + template + flat_set(const flat_set&, const Alloc& a); + template + flat_set(flat_set&&, const Alloc& a); + template + flat_set(const container_type& cont, const Alloc& a); + template + flat_set(const container_type& cont, const key_compare& comp, const Alloc& a); + template + flat_set(sorted_unique_t, const container_type& cont, const Alloc& a); + template + flat_set(sorted_unique_t, const container_type& cont, + const key_compare& comp, const Alloc& a); + template + flat_set(const key_compare& comp, const Alloc& a); + template + explicit flat_set(const Alloc& a); + template + flat_set(InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); + template + flat_set(InputIterator first, InputIterator last, const Alloc& a); + template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_set(from_range_t, R&& rg, const Alloc& a); + template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_set(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); + template + flat_set(sorted_unique_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); + template + flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); + template + flat_set(initializer_list il, const key_compare& comp, const Alloc& a); + template + flat_set(initializer_list il, const Alloc& a); + template flat_set(sorted_unique_t, initializer_list il, - const key_compare& comp, const Allocator& a); - template - flat_set(sorted_unique_t, initializer_list il, const Allocator& a); + const key_compare& comp, const Alloc& a); + template + flat_set(sorted_unique_t, initializer_list il, const Alloc& a); flat_set& operator=(initializer_list); @@ -17214,23 +17216,25 @@ \pnum \complexity -Linear in $N$ if \tcode{cont} is sorted with respect to \exposid{compare} and +Linear in $N$ if \tcode{cont} is already sorted with respect to \exposid{compare} and otherwise $N \log N$, where $N$ is the value of \tcode{cont.size()} before this call. \end{itemdescr} +\rSec3[flat.set.cons.alloc]{Constructors with allocators} + +\pnum +The constructors in this subclause shall not participate in overload resolution +unless \tcode{uses_allocator_v} is \tcode{true}. + \indexlibraryctor{flat_set}% \begin{itemdecl} -template - flat_set(const container_type& cont, const Allocator& a); -template - flat_set(const container_type& cont, const key_compare& comp, const Allocator& a); +template + flat_set(const container_type& cont, const Alloc& a); +template + flat_set(const container_type& cont, const key_compare& comp, const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to @@ -17245,18 +17249,14 @@ \indexlibraryctor{flat_set}% \begin{itemdecl} -template - flat_set(sorted_unique_t s, const container_type& cont, const Allocator& a); -template +template + flat_set(sorted_unique_t s, const container_type& cont, const Alloc& a); +template flat_set(sorted_unique_t s, const container_type& cont, - const key_compare& comp, const Allocator& a); + const key_compare& comp, const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to @@ -17271,43 +17271,39 @@ \indexlibraryctor{flat_set}% \begin{itemdecl} -template - flat_set(const flat_set&, const Allocator& a); -template - flat_set(flat_set&&, const Allocator& a); -template - flat_set(const key_compare& comp, const Allocator& a); -template - explicit flat_set(const Allocator& a); -template - flat_set(InputIterator first, InputIterator last, const key_compare& comp, const Allocator& a); -template - flat_set(InputIterator first, InputIterator last, const Allocator& a); -template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_set(from_range_t, R&& rg, const Allocator& a); -template<@\exposconcept{container-compatible-range}@ R, class Allocator> - flat_set(from_range_t, R&& rg, const key_compare& comp, const Allocator& a); -template +template + flat_set(const flat_set&, const Alloc& a); +template + flat_set(flat_set&&, const Alloc& a); +template + flat_set(const key_compare& comp, const Alloc& a); +template + explicit flat_set(const Alloc& a); +template + flat_set(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); +template + flat_set(InputIterator first, InputIterator last, const Alloc& a); +template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_set(from_range_t, R&& rg, const Alloc& a); +template<@\exposconcept{container-compatible-range}@ R, class Alloc> + flat_set(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); +template flat_set(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp, const Allocator& a); -template - flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Allocator& a); -template - flat_set(initializer_list il, const key_compare& comp, const Allocator& a); -template - flat_set(initializer_list il, const Allocator& a); -template + const key_compare& comp, const Alloc& a); +template + flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_set(initializer_list il, const key_compare& comp, const Alloc& a); +template + flat_set(initializer_list il, const Alloc& a); +template flat_set(sorted_unique_t, initializer_list il, - const key_compare& comp, const Allocator& a); -template - flat_set(sorted_unique_t, initializer_list il, const Allocator& a); + const key_compare& comp, const Alloc& a); +template + flat_set(sorted_unique_t, initializer_list il, const Alloc& a); \end{itemdecl} \begin{itemdescr} -\pnum -\constraints -\tcode{uses_allocator_v} is \tcode{true}. - \pnum \effects Equivalent to the corresponding non-allocator constructors From 37a21e24eb1132d06896b7971b21f91b078b0c8f Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Fri, 16 Jun 2023 05:47:48 -0400 Subject: [PATCH 8/8] [flat.set] P2767R0 section 3 swaps requested by jwakely in LWG Swap the default ctor to the top. Follow each non-`key_compare` overload by its `key_compare` counterpart. Then, follow each non-`sorted_unique` pair of overloads by its `sorted_unique` counterparts. --- source/containers.tex | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/source/containers.tex b/source/containers.tex index 566c201be1..e5a33d6a26 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -16957,19 +16957,24 @@ // \ref{flat.set.cons}, constructors flat_set() : flat_set(key_compare()) { } + explicit flat_set(const key_compare& comp) + : @\exposid{c}@(), @\exposid{compare}@(comp) { } + explicit flat_set(container_type cont, const key_compare& comp = key_compare()); flat_set(sorted_unique_t, container_type cont, const key_compare& comp = key_compare()) : @\exposid{c}@(std::move(cont)), @\exposid{compare}@(comp) { } - explicit flat_set(const key_compare& comp) - : @\exposid{c}@(), @\exposid{compare}@(comp) { } - template flat_set(InputIterator first, InputIterator last, const key_compare& comp = key_compare()) : @\exposid{c}@(), @\exposid{compare}@(comp) { insert(first, last); } + template + flat_set(sorted_unique_t, InputIterator first, InputIterator last, + const key_compare& comp = key_compare()) + : @\exposid{c}@(first, last), @\exposid{compare}@(comp) { } + template<@\exposconcept{container-compatible-range}@ R> flat_set(from_range_t fr, R&& rg) : flat_set(fr, std::forward(rg), key_compare()) { } @@ -16978,11 +16983,6 @@ : flat_set(comp) { insert_range(std::forward(rg)); } - template - flat_set(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp = key_compare()) - : @\exposid{c}@(first, last), @\exposid{compare}@(comp) { } - flat_set(initializer_list il, const key_compare& comp = key_compare()) : flat_set(il.begin(), il.end(), comp) { } @@ -16993,9 +16993,9 @@ // \ref{flat.set.cons.alloc}, constructors with allocators template - flat_set(const flat_set&, const Alloc& a); + explicit flat_set(const Alloc& a); template - flat_set(flat_set&&, const Alloc& a); + flat_set(const key_compare& comp, const Alloc& a); template flat_set(const container_type& cont, const Alloc& a); template @@ -17006,32 +17006,32 @@ flat_set(sorted_unique_t, const container_type& cont, const key_compare& comp, const Alloc& a); template - flat_set(const key_compare& comp, const Alloc& a); + flat_set(const flat_set&, const Alloc& a); template - explicit flat_set(const Alloc& a); + flat_set(flat_set&&, const Alloc& a); + template + flat_set(InputIterator first, InputIterator last, const Alloc& a); template flat_set(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); template - flat_set(InputIterator first, InputIterator last, const Alloc& a); + flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); + template + flat_set(sorted_unique_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_set(from_range_t, R&& rg, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_set(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); - template - flat_set(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp, const Alloc& a); - template - flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); + template + flat_set(initializer_list il, const Alloc& a); template flat_set(initializer_list il, const key_compare& comp, const Alloc& a); template - flat_set(initializer_list il, const Alloc& a); + flat_set(sorted_unique_t, initializer_list il, const Alloc& a); template flat_set(sorted_unique_t, initializer_list il, const key_compare& comp, const Alloc& a); - template - flat_set(sorted_unique_t, initializer_list il, const Alloc& a); flat_set& operator=(initializer_list); @@ -17272,35 +17272,35 @@ \indexlibraryctor{flat_set}% \begin{itemdecl} template - flat_set(const flat_set&, const Alloc& a); -template - flat_set(flat_set&&, const Alloc& a); + explicit flat_set(const Alloc& a); template flat_set(const key_compare& comp, const Alloc& a); template - explicit flat_set(const Alloc& a); + flat_set(const flat_set&, const Alloc& a); +template + flat_set(flat_set&&, const Alloc& a); +template + flat_set(InputIterator first, InputIterator last, const Alloc& a); template flat_set(InputIterator first, InputIterator last, const key_compare& comp, const Alloc& a); template - flat_set(InputIterator first, InputIterator last, const Alloc& a); + flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_set(sorted_unique_t, InputIterator first, InputIterator last, + const key_compare& comp, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_set(from_range_t, R&& rg, const Alloc& a); template<@\exposconcept{container-compatible-range}@ R, class Alloc> flat_set(from_range_t, R&& rg, const key_compare& comp, const Alloc& a); -template - flat_set(sorted_unique_t, InputIterator first, InputIterator last, - const key_compare& comp, const Alloc& a); -template - flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Alloc& a); +template + flat_set(initializer_list il, const Alloc& a); template flat_set(initializer_list il, const key_compare& comp, const Alloc& a); template - flat_set(initializer_list il, const Alloc& a); + flat_set(sorted_unique_t, initializer_list il, const Alloc& a); template flat_set(sorted_unique_t, initializer_list il, const key_compare& comp, const Alloc& a); -template - flat_set(sorted_unique_t, initializer_list il, const Alloc& a); \end{itemdecl} \begin{itemdescr}