|
17033 | 17033 |
|
17034 | 17034 | \pnum |
17035 | 17035 | If any member function in \ref{flat.map.defn} exits via an exception |
17036 | | -the invariants are restored. |
| 17036 | +the invariants of the object argument are restored. |
| 17037 | +For the move constructor and move assignment operator, |
| 17038 | +the invariants of both arguments are restored. |
17037 | 17039 | \begin{note} |
17038 | 17040 | This can result in the \tcode{flat_map} being emptied. |
17039 | 17041 | \end{note} |
|
17118 | 17120 | // \ref{flat.map.cons}, constructors |
17119 | 17121 | constexpr flat_map() : flat_map(key_compare()) { } |
17120 | 17122 |
|
| 17123 | + flat_map(const flat_map&); |
| 17124 | + flat_map(flat_map&&); |
| 17125 | + flat_map& operator=(const flat_map&); |
| 17126 | + flat_map& operator=(flat_map&&); |
| 17127 | + |
17121 | 17128 | constexpr explicit flat_map(const key_compare& comp) |
17122 | 17129 | : @\exposid{c}@(), @\exposid{compare}@(comp) { } |
17123 | 17130 |
|
|
17258 | 17265 | constexpr void insert(sorted_unique_t, InputIterator first, InputIterator last); |
17259 | 17266 | template<@\exposconcept{container-compatible-range}@<value_type> R> |
17260 | 17267 | constexpr void insert_range(R&& rg); |
| 17268 | + template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 17269 | + void insert_range(sorted_unique_t, R&& rg); |
17261 | 17270 |
|
17262 | 17271 | constexpr void insert(initializer_list<value_type> il) |
17263 | 17272 | { insert(il.begin(), il.end()); } |
|
17298 | 17307 | template<class K> constexpr size_type erase(K&& x); |
17299 | 17308 | constexpr iterator erase(const_iterator first, const_iterator last); |
17300 | 17309 |
|
17301 | | - constexpr void swap(flat_map& y) noexcept; |
| 17310 | + constexpr void swap(flat_map& y) noexcept(@\seebelow@); |
17302 | 17311 | constexpr void clear() noexcept; |
17303 | 17312 |
|
17304 | 17313 | // observers |
|
17341 | 17350 | friend constexpr @\exposid{synth-three-way-result}@<value_type> |
17342 | 17351 | operator<=>(const flat_map& x, const flat_map& y); |
17343 | 17352 |
|
17344 | | - friend constexpr void swap(flat_map& x, flat_map& y) noexcept |
| 17353 | + friend constexpr void swap(flat_map& x, flat_map& y) noexcept(noexcept(x.swap(y))) |
17345 | 17354 | { x.swap(y); } |
17346 | 17355 |
|
17347 | 17356 | private: |
@@ -17816,10 +17825,10 @@ |
17816 | 17825 | \effects |
17817 | 17826 | Adds elements to \exposid{c} as if by: |
17818 | 17827 | \begin{codeblock} |
17819 | | -for (const auto& e : rg) { |
17820 | | - @\exposid{c}@.keys.insert(@\exposid{c}@.keys.end(), e.first); |
17821 | | - @\exposid{c}@.values.insert(@\exposid{c}@.values.end(), e.second); |
17822 | | -} |
| 17828 | +ranges::for_each(rg, [&](value_type e) { |
| 17829 | + @\exposid{c}@.keys.insert(@\exposid{c}@.keys.end(), std::move(e.first)); |
| 17830 | + @\exposid{c}@.values.insert(@\exposid{c}@.values.end(), std::move(e.second)); |
| 17831 | +}); |
17823 | 17832 | \end{codeblock} |
17824 | 17833 | Then, sorts the range of newly inserted elements |
17825 | 17834 | with respect to \tcode{value_comp()}; |
|
17845 | 17854 | Since this operation performs an in-place merge, it may allocate memory. |
17846 | 17855 | \end{itemdescr} |
17847 | 17856 |
|
| 17857 | +\indexlibrarymember{insert_range}{flat_map}% |
| 17858 | +\begin{itemdecl} |
| 17859 | +template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 17860 | + void insert_range(sorted_unique_t, R&& rg); |
| 17861 | +\end{itemdecl} |
| 17862 | + |
| 17863 | +\begin{itemdescr} |
| 17864 | +\pnum |
| 17865 | +\effects |
| 17866 | +Equivalent to \tcode{insert_range(rg)}. |
| 17867 | + |
| 17868 | +\pnum |
| 17869 | +\complexity |
| 17870 | +Linear in $N$, where $N$ is \tcode{size()} after the operation. |
| 17871 | +\end{itemdescr} |
| 17872 | + |
17848 | 17873 | \indexlibrarymember{try_emplace}{flat_map}% |
17849 | 17874 | \begin{itemdecl} |
17850 | 17875 | template<class... Args> |
|
18047 | 18072 |
|
18048 | 18073 | \indexlibrarymember{swap}{flat_map}% |
18049 | 18074 | \begin{itemdecl} |
18050 | | -constexpr void swap(flat_map& y) noexcept; |
| 18075 | +constexpr void swap(flat_map& y) |
| 18076 | + noexcept(is_nothrow_swappable_v<key_container_type> && |
| 18077 | + is_nothrow_swappable_v<mapped_container_type> && |
| 18078 | + is_nothrow_swappable_v<key_compare>); |
18051 | 18079 | \end{itemdecl} |
18052 | 18080 |
|
18053 | 18081 | \begin{itemdescr} |
|
18209 | 18237 |
|
18210 | 18238 | \pnum |
18211 | 18239 | If any member function in \ref{flat.multimap.defn} exits via an exception, |
18212 | | -the invariants are restored. |
| 18240 | +the invariants of the object argument are restored. |
| 18241 | +For the move constructor and move assignment operator, |
| 18242 | +the invariants of both arguments are restored. |
18213 | 18243 | \begin{note} |
18214 | 18244 | This can result in the \tcode{flat_multimap} being emptied. |
18215 | 18245 | \end{note} |
|
18292 | 18322 | // \ref{flat.multimap.cons}, constructors |
18293 | 18323 | constexpr flat_multimap() : flat_multimap(key_compare()) { } |
18294 | 18324 |
|
| 18325 | + flat_multimap(const flat_multimap&); |
| 18326 | + flat_multimap(flat_multimap&&); |
| 18327 | + flat_multimap& operator=(const flat_multimap&); |
| 18328 | + flat_multimap& operator=(flat_multimap&&); |
| 18329 | + |
18295 | 18330 | constexpr explicit flat_multimap(const key_compare& comp) |
18296 | 18331 | : @\exposid{c}@(), @\exposid{compare}@(comp) { } |
18297 | 18332 |
|
|
18425 | 18460 | constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last); |
18426 | 18461 | template<@\exposconcept{container-compatible-range}@<value_type> R> |
18427 | 18462 | constexpr void insert_range(R&& rg); |
| 18463 | + template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 18464 | + void insert_range(sorted_unique_t, R&& rg); |
18428 | 18465 |
|
18429 | 18466 | constexpr void insert(initializer_list<value_type> il) |
18430 | 18467 | { insert(il.begin(), il.end()); } |
|
18440 | 18477 | template<class K> constexpr size_type erase(K&& x); |
18441 | 18478 | constexpr iterator erase(const_iterator first, const_iterator last); |
18442 | 18479 |
|
18443 | | - constexpr void swap(flat_multimap&) noexcept; |
| 18480 | + constexpr void swap(flat_multimap&) |
| 18481 | + noexcept(is_nothrow_swappable_v<key_container_type> && |
| 18482 | + is_nothrow_swappable_v<mapped_container_type> && |
| 18483 | + is_nothrow_swappable_v<key_compare>); |
18444 | 18484 | constexpr void clear() noexcept; |
18445 | 18485 |
|
18446 | 18486 | // observers |
|
18484 | 18524 | friend constexpr @\exposid{synth-three-way-result}@<value_type> |
18485 | 18525 | operator<=>(const flat_multimap& x, const flat_multimap& y); |
18486 | 18526 |
|
18487 | | - friend constexpr void swap(flat_multimap& x, flat_multimap& y) noexcept |
| 18527 | + friend constexpr void swap(flat_multimap& x, flat_multimap& y) |
| 18528 | + noexcept(noexcept(x.swap(y))) |
18488 | 18529 | { x.swap(y); } |
18489 | 18530 |
|
18490 | 18531 | private: |
|
18852 | 18893 |
|
18853 | 18894 | \pnum |
18854 | 18895 | If any member function in \ref{flat.set.defn} exits via an exception, |
18855 | | -the invariant is restored. |
| 18896 | +the invariant of the object argument is restored. |
| 18897 | +For the move constructor and move assignment operator, |
| 18898 | +the invariants of both arguments are restored. |
18856 | 18899 | \begin{note} |
18857 | 18900 | This can result in the \tcode{flat_set}'s being emptied. |
18858 | 18901 | \end{note} |
|
18906 | 18949 | // \ref{flat.set.cons}, constructors |
18907 | 18950 | constexpr flat_set() : flat_set(key_compare()) { } |
18908 | 18951 |
|
| 18952 | + flat_set(const flat_set&); |
| 18953 | + flat_set(flat_set&&); |
| 18954 | + flat_set& operator=(const flat_set&); |
| 18955 | + flat_set& operator=(flat_set&&); |
| 18956 | + |
18909 | 18957 | constexpr explicit flat_set(const key_compare& comp) |
18910 | 18958 | : @\exposid{c}@(), @\exposid{compare}@(comp) { } |
18911 | 18959 |
|
|
19031 | 19079 | constexpr void insert(sorted_unique_t, InputIterator first, InputIterator last); |
19032 | 19080 | template<@\exposconcept{container-compatible-range}@<value_type> R> |
19033 | 19081 | constexpr void insert_range(R&& rg); |
| 19082 | + template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 19083 | + void insert_range(sorted_unique_t, R&& rg); |
19034 | 19084 |
|
19035 | 19085 | constexpr void insert(initializer_list<value_type> il) |
19036 | 19086 | { insert(il.begin(), il.end()); } |
|
19359 | 19409 | \effects |
19360 | 19410 | Adds elements to \exposid{c} as if by: |
19361 | 19411 | \begin{codeblock} |
19362 | | -for (const auto& e : rg) { |
19363 | | - @\exposid{c}@.insert(@\exposid{c}@.end(), e); |
19364 | | -} |
| 19412 | +ranges::for_each(rg, [&](auto&& e) { |
| 19413 | + @\exposid{c}@.insert(@\exposid{c}@.end(), std::forward<decltype(e)>(e)); |
| 19414 | +}); |
19365 | 19415 | \end{codeblock} |
19366 | 19416 | Then, |
19367 | 19417 | sorts the range of newly inserted elements with respect to \exposid{compare}; |
|
19380 | 19430 | Since this operation performs an in-place merge, it may allocate memory. |
19381 | 19431 | \end{itemdescr} |
19382 | 19432 |
|
| 19433 | +\indexlibrarymember{insert_range}{flat_set}% |
| 19434 | +\begin{itemdecl} |
| 19435 | +template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 19436 | + void insert_range(sorted_unique_t, R&& rg); |
| 19437 | +\end{itemdecl} |
| 19438 | + |
| 19439 | +\begin{itemdescr} |
| 19440 | +\pnum |
| 19441 | +\effects |
| 19442 | +Equivalent to \tcode{insert_range(rg)}. |
| 19443 | + |
| 19444 | +\pnum |
| 19445 | +\complexity |
| 19446 | +Linear in $N$, where $N$ is \tcode{size()} after the operation. |
| 19447 | +\end{itemdescr} |
| 19448 | + |
19383 | 19449 | \indexlibrarymember{swap}{flat_set}% |
19384 | 19450 | \begin{itemdecl} |
19385 | | -constexpr void swap(flat_set& y) noexcept; |
| 19451 | +constexpr void swap(flat_set& y) |
| 19452 | + noexcept(is_nothrow_swappable_v<container_type> && |
| 19453 | + is_nothrow_swappable_v<key_compare>); |
19386 | 19454 | \end{itemdecl} |
19387 | 19455 |
|
19388 | 19456 | \begin{itemdescr} |
|
19522 | 19590 |
|
19523 | 19591 | \pnum |
19524 | 19592 | If any member function in \ref{flat.multiset.defn} exits via an exception, |
19525 | | -the invariant is restored. |
| 19593 | +the invariant of the object argument is restored. |
| 19594 | +For the move constructor and move assignment operator, |
| 19595 | +the invariants of both arguments are restored. |
19526 | 19596 | \begin{note} |
19527 | 19597 | This can result in the \tcode{flat_multiset}'s being emptied. |
19528 | 19598 | \end{note} |
|
19575 | 19645 | // \ref{flat.multiset.cons}, constructors |
19576 | 19646 | constexpr flat_multiset() : flat_multiset(key_compare()) { } |
19577 | 19647 |
|
| 19648 | + flat_multiset(const flat_multiset&); |
| 19649 | + flat_multiset(flat_multiset&&); |
| 19650 | + flat_multiset& operator=(const flat_multiset&); |
| 19651 | + flat_multiset& operator=(flat_multiset&&); |
| 19652 | + |
19578 | 19653 | constexpr explicit flat_multiset(const key_compare& comp) |
19579 | 19654 | : @\exposid{c}@(), @\exposid{compare}@(comp) { } |
19580 | 19655 |
|
|
19702 | 19777 | constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last); |
19703 | 19778 | template<@\exposconcept{container-compatible-range}@<value_type> R> |
19704 | 19779 | constexpr void insert_range(R&& rg); |
| 19780 | + template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 19781 | + void insert_range(sorted_unique_t, R&& rg); |
19705 | 19782 |
|
19706 | 19783 | constexpr void insert(initializer_list<value_type> il) |
19707 | 19784 | { insert(il.begin(), il.end()); } |
|
19717 | 19794 | template<class K> constexpr size_type erase(K&& x); |
19718 | 19795 | constexpr iterator erase(const_iterator first, const_iterator last); |
19719 | 19796 |
|
19720 | | - constexpr void swap(flat_multiset& y) noexcept; |
| 19797 | + constexpr void swap(flat_multiset& y) noexcept(@\seebelow@); |
19721 | 19798 | constexpr void clear() noexcept; |
19722 | 19799 |
|
19723 | 19800 | // observers |
|
19758 | 19835 | friend constexpr @\exposid{synth-three-way-result}@<value_type> |
19759 | 19836 | operator<=>(const flat_multiset& x, const flat_multiset& y); |
19760 | 19837 |
|
19761 | | - friend constexpr void swap(flat_multiset& x, flat_multiset& y) noexcept |
| 19838 | + friend constexpr void swap(flat_multiset& x, flat_multiset& y) |
| 19839 | + noexcept(noexcept(x.swap(y))) |
19762 | 19840 | { x.swap(y); } |
19763 | 19841 |
|
19764 | 19842 | private: |
@@ -20005,12 +20083,60 @@ |
20005 | 20083 |
|
20006 | 20084 | \pnum |
20007 | 20085 | \complexity |
20008 | | -Linear. |
| 20086 | +Linear in $N$, where $N$ is \tcode{size()} after the operation. |
| 20087 | +\end{itemdescr} |
| 20088 | + |
| 20089 | +\indexlibrarymember{insert_range}{flat_multiset}% |
| 20090 | +\begin{itemdecl} |
| 20091 | +template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 20092 | + void insert_range(R&& rg); |
| 20093 | +\end{itemdecl} |
| 20094 | + |
| 20095 | +\begin{itemdescr} |
| 20096 | +\pnum |
| 20097 | +\effects |
| 20098 | +Adds elements to \exposid{c} as if by: |
| 20099 | +\begin{codeblock} |
| 20100 | +ranges::for_each(rg, [&](auto&& e) { |
| 20101 | + @\exposid{c}@.insert(@\exposid{c}@.end(), std::forward<decltype(e)>(e)); |
| 20102 | +}); |
| 20103 | +\end{codeblock} |
| 20104 | +Then, sorts the range of newly inserted elements with respect to \exposid{compare}, |
| 20105 | +and merges the resulting sorted range and |
| 20106 | +the sorted range of pre-existing elements into a single sorted range. |
| 20107 | + |
| 20108 | +\pnum |
| 20109 | +\complexity |
| 20110 | +$N$ + $M \log M$, where $N$ is \tcode{size()} before the operation and $M$ |
| 20111 | +is \tcode{ranges::distance(rg)}. |
| 20112 | + |
| 20113 | +\pnum |
| 20114 | +\remarks |
| 20115 | +Since this operation performs an in-place merge, |
| 20116 | +it may allocate memory. |
| 20117 | +\end{itemdescr} |
| 20118 | + |
| 20119 | +\indexlibrarymember{insert_range}{flat_multiset}% |
| 20120 | +\begin{itemdecl} |
| 20121 | +template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 20122 | + void insert_range(sorted_unique_t, R&& rg); |
| 20123 | +\end{itemdecl} |
| 20124 | + |
| 20125 | +\begin{itemdescr} |
| 20126 | +\pnum |
| 20127 | +\effects |
| 20128 | +Equivalent to \tcode{insert_range(rg)}. |
| 20129 | + |
| 20130 | +\pnum |
| 20131 | +\complexity |
| 20132 | +Linear in $N$, where $N$ is \tcode{size()} after the operation. |
20009 | 20133 | \end{itemdescr} |
20010 | 20134 |
|
20011 | 20135 | \indexlibrarymember{swap}{flat_multiset}% |
20012 | 20136 | \begin{itemdecl} |
20013 | | -constexpr void swap(flat_multiset& y) noexcept; |
| 20137 | +constexpr void swap(flat_multiset& y) |
| 20138 | + noexcept(is_nothrow_swappable_v<container_type> && |
| 20139 | + is_nothrow_swappable_v<key_compare>); |
20014 | 20140 | \end{itemdecl} |
20015 | 20141 |
|
20016 | 20142 | \begin{itemdescr} |
|
0 commit comments