|
17052 | 17052 |
|
17053 | 17053 | \pnum |
17054 | 17054 | If any member function in \ref{flat.map.defn} exits via an exception |
17055 | | -the invariants are restored. |
| 17055 | +the invariants of the object argument are restored. |
| 17056 | +For the move constructor and move assignment operator, |
| 17057 | +the invariants of both arguments are restored. |
17056 | 17058 | \begin{note} |
17057 | 17059 | This can result in the \tcode{flat_map} being emptied. |
17058 | 17060 | \end{note} |
|
17137 | 17139 | // \ref{flat.map.cons}, constructors |
17138 | 17140 | constexpr flat_map() : flat_map(key_compare()) { } |
17139 | 17141 |
|
| 17142 | + constexpr flat_map(const flat_map&); |
| 17143 | + constexpr flat_map(flat_map&&); |
| 17144 | + constexpr flat_map& operator=(const flat_map&); |
| 17145 | + constexpr flat_map& operator=(flat_map&&); |
| 17146 | + |
17140 | 17147 | constexpr explicit flat_map(const key_compare& comp) |
17141 | 17148 | : @\exposid{c}@(), @\exposid{compare}@(comp) { } |
17142 | 17149 |
|
|
17277 | 17284 | constexpr void insert(sorted_unique_t, InputIterator first, InputIterator last); |
17278 | 17285 | template<@\exposconcept{container-compatible-range}@<value_type> R> |
17279 | 17286 | constexpr void insert_range(R&& rg); |
| 17287 | + template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 17288 | + constexpr void insert_range(sorted_unique_t, R&& rg); |
17280 | 17289 |
|
17281 | 17290 | constexpr void insert(initializer_list<value_type> il) |
17282 | 17291 | { insert(il.begin(), il.end()); } |
|
17317 | 17326 | template<class K> constexpr size_type erase(K&& x); |
17318 | 17327 | constexpr iterator erase(const_iterator first, const_iterator last); |
17319 | 17328 |
|
17320 | | - constexpr void swap(flat_map& y) noexcept; |
| 17329 | + constexpr void swap(flat_map& y) noexcept(@\seebelow@); |
17321 | 17330 | constexpr void clear() noexcept; |
17322 | 17331 |
|
17323 | 17332 | // observers |
|
17360 | 17369 | friend constexpr @\exposid{synth-three-way-result}@<value_type> |
17361 | 17370 | operator<=>(const flat_map& x, const flat_map& y); |
17362 | 17371 |
|
17363 | | - friend constexpr void swap(flat_map& x, flat_map& y) noexcept |
| 17372 | + friend constexpr void swap(flat_map& x, flat_map& y) noexcept(noexcept(x.swap(y))) |
17364 | 17373 | { x.swap(y); } |
17365 | 17374 |
|
17366 | 17375 | private: |
@@ -17835,10 +17844,10 @@ |
17835 | 17844 | \effects |
17836 | 17845 | Adds elements to \exposid{c} as if by: |
17837 | 17846 | \begin{codeblock} |
17838 | | -for (const auto& e : rg) { |
17839 | | - @\exposid{c}@.keys.insert(@\exposid{c}@.keys.end(), e.first); |
17840 | | - @\exposid{c}@.values.insert(@\exposid{c}@.values.end(), e.second); |
17841 | | -} |
| 17847 | +ranges::for_each(rg, [&](value_type e) { |
| 17848 | + @\exposid{c}@.keys.insert(@\exposid{c}@.keys.end(), std::move(e.first)); |
| 17849 | + @\exposid{c}@.values.insert(@\exposid{c}@.values.end(), std::move(e.second)); |
| 17850 | +}); |
17842 | 17851 | \end{codeblock} |
17843 | 17852 | Then, sorts the range of newly inserted elements |
17844 | 17853 | with respect to \tcode{value_comp()}; |
|
17864 | 17873 | Since this operation performs an in-place merge, it may allocate memory. |
17865 | 17874 | \end{itemdescr} |
17866 | 17875 |
|
| 17876 | +\indexlibrarymember{insert_range}{flat_map}% |
| 17877 | +\begin{itemdecl} |
| 17878 | +template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 17879 | + constexpr void insert_range(sorted_unique_t, R&& rg); |
| 17880 | +\end{itemdecl} |
| 17881 | + |
| 17882 | +\begin{itemdescr} |
| 17883 | +\pnum |
| 17884 | +\effects |
| 17885 | +Equivalent to \tcode{insert_range(rg)}. |
| 17886 | + |
| 17887 | +\pnum |
| 17888 | +\complexity |
| 17889 | +Linear in $N$, where $N$ is \tcode{size()} after the operation. |
| 17890 | +\end{itemdescr} |
| 17891 | + |
17867 | 17892 | \indexlibrarymember{try_emplace}{flat_map}% |
17868 | 17893 | \begin{itemdecl} |
17869 | 17894 | template<class... Args> |
|
18066 | 18091 |
|
18067 | 18092 | \indexlibrarymember{swap}{flat_map}% |
18068 | 18093 | \begin{itemdecl} |
18069 | | -constexpr void swap(flat_map& y) noexcept; |
| 18094 | +constexpr void swap(flat_map& y) |
| 18095 | + noexcept(is_nothrow_swappable_v<key_container_type> && |
| 18096 | + is_nothrow_swappable_v<mapped_container_type> && |
| 18097 | + is_nothrow_swappable_v<key_compare>); |
18070 | 18098 | \end{itemdecl} |
18071 | 18099 |
|
18072 | 18100 | \begin{itemdescr} |
|
18228 | 18256 |
|
18229 | 18257 | \pnum |
18230 | 18258 | If any member function in \ref{flat.multimap.defn} exits via an exception, |
18231 | | -the invariants are restored. |
| 18259 | +the invariants of the object argument are restored. |
| 18260 | +For the move constructor and move assignment operator, |
| 18261 | +the invariants of both arguments are restored. |
18232 | 18262 | \begin{note} |
18233 | 18263 | This can result in the \tcode{flat_multimap} being emptied. |
18234 | 18264 | \end{note} |
|
18311 | 18341 | // \ref{flat.multimap.cons}, constructors |
18312 | 18342 | constexpr flat_multimap() : flat_multimap(key_compare()) { } |
18313 | 18343 |
|
| 18344 | + constexpr flat_multimap(const flat_multimap&); |
| 18345 | + constexpr flat_multimap(flat_multimap&&); |
| 18346 | + constexpr flat_multimap& operator=(const flat_multimap&); |
| 18347 | + constexpr flat_multimap& operator=(flat_multimap&&); |
| 18348 | + |
18314 | 18349 | constexpr explicit flat_multimap(const key_compare& comp) |
18315 | 18350 | : @\exposid{c}@(), @\exposid{compare}@(comp) { } |
18316 | 18351 |
|
|
18444 | 18479 | constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last); |
18445 | 18480 | template<@\exposconcept{container-compatible-range}@<value_type> R> |
18446 | 18481 | constexpr void insert_range(R&& rg); |
| 18482 | + template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 18483 | + constexpr void insert_range(sorted_equivalent_t, R&& rg); |
18447 | 18484 |
|
18448 | 18485 | constexpr void insert(initializer_list<value_type> il) |
18449 | 18486 | { insert(il.begin(), il.end()); } |
|
18459 | 18496 | template<class K> constexpr size_type erase(K&& x); |
18460 | 18497 | constexpr iterator erase(const_iterator first, const_iterator last); |
18461 | 18498 |
|
18462 | | - constexpr void swap(flat_multimap&) noexcept; |
| 18499 | + constexpr void swap(flat_multimap&) |
| 18500 | + noexcept(is_nothrow_swappable_v<key_container_type> && |
| 18501 | + is_nothrow_swappable_v<mapped_container_type> && |
| 18502 | + is_nothrow_swappable_v<key_compare>); |
18463 | 18503 | constexpr void clear() noexcept; |
18464 | 18504 |
|
18465 | 18505 | // observers |
|
18503 | 18543 | friend constexpr @\exposid{synth-three-way-result}@<value_type> |
18504 | 18544 | operator<=>(const flat_multimap& x, const flat_multimap& y); |
18505 | 18545 |
|
18506 | | - friend constexpr void swap(flat_multimap& x, flat_multimap& y) noexcept |
| 18546 | + friend constexpr void swap(flat_multimap& x, flat_multimap& y) |
| 18547 | + noexcept(noexcept(x.swap(y))) |
18507 | 18548 | { x.swap(y); } |
18508 | 18549 |
|
18509 | 18550 | private: |
|
18871 | 18912 |
|
18872 | 18913 | \pnum |
18873 | 18914 | If any member function in \ref{flat.set.defn} exits via an exception, |
18874 | | -the invariant is restored. |
| 18915 | +the invariant of the object argument is restored. |
| 18916 | +For the move constructor and move assignment operator, |
| 18917 | +the invariants of both arguments are restored. |
18875 | 18918 | \begin{note} |
18876 | 18919 | This can result in the \tcode{flat_set}'s being emptied. |
18877 | 18920 | \end{note} |
|
18925 | 18968 | // \ref{flat.set.cons}, constructors |
18926 | 18969 | constexpr flat_set() : flat_set(key_compare()) { } |
18927 | 18970 |
|
| 18971 | + constexpr flat_set(const flat_set&); |
| 18972 | + constexpr flat_set(flat_set&&); |
| 18973 | + constexpr flat_set& operator=(const flat_set&); |
| 18974 | + constexpr flat_set& operator=(flat_set&&); |
| 18975 | + |
18928 | 18976 | constexpr explicit flat_set(const key_compare& comp) |
18929 | 18977 | : @\exposid{c}@(), @\exposid{compare}@(comp) { } |
18930 | 18978 |
|
|
19050 | 19098 | constexpr void insert(sorted_unique_t, InputIterator first, InputIterator last); |
19051 | 19099 | template<@\exposconcept{container-compatible-range}@<value_type> R> |
19052 | 19100 | constexpr void insert_range(R&& rg); |
| 19101 | + template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 19102 | + constexpr void insert_range(sorted_unique_t, R&& rg); |
19053 | 19103 |
|
19054 | 19104 | constexpr void insert(initializer_list<value_type> il) |
19055 | 19105 | { insert(il.begin(), il.end()); } |
|
19065 | 19115 | template<class K> constexpr size_type erase(K&& x); |
19066 | 19116 | constexpr iterator erase(const_iterator first, const_iterator last); |
19067 | 19117 |
|
19068 | | - constexpr void swap(flat_set& y) noexcept; |
| 19118 | + constexpr void swap(flat_set& y) noexcept(@\seebelow@); |
19069 | 19119 | constexpr void clear() noexcept; |
19070 | 19120 |
|
19071 | 19121 | // observers |
|
19106 | 19156 | friend constexpr @\exposid{synth-three-way-result}@<value_type> |
19107 | 19157 | operator<=>(const flat_set& x, const flat_set& y); |
19108 | 19158 |
|
19109 | | - friend constexpr void swap(flat_set& x, flat_set& y) noexcept { x.swap(y); } |
| 19159 | + friend constexpr void swap(flat_set& x, flat_set& y) noexcept(noexcept(x.swap(y))) |
| 19160 | + { x.swap(y); } |
19110 | 19161 |
|
19111 | 19162 | private: |
19112 | 19163 | container_type @\exposidnc{c}@; // \expos |
|
19378 | 19429 | \effects |
19379 | 19430 | Adds elements to \exposid{c} as if by: |
19380 | 19431 | \begin{codeblock} |
19381 | | -for (const auto& e : rg) { |
19382 | | - @\exposid{c}@.insert(@\exposid{c}@.end(), e); |
19383 | | -} |
| 19432 | +ranges::for_each(rg, [&](auto&& e) { |
| 19433 | + @\exposid{c}@.insert(@\exposid{c}@.end(), std::forward<decltype(e)>(e)); |
| 19434 | +}); |
19384 | 19435 | \end{codeblock} |
19385 | 19436 | Then, |
19386 | 19437 | sorts the range of newly inserted elements with respect to \exposid{compare}; |
|
19399 | 19450 | Since this operation performs an in-place merge, it may allocate memory. |
19400 | 19451 | \end{itemdescr} |
19401 | 19452 |
|
| 19453 | +\indexlibrarymember{insert_range}{flat_set}% |
| 19454 | +\begin{itemdecl} |
| 19455 | +template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 19456 | + constexpr void insert_range(sorted_unique_t, R&& rg); |
| 19457 | +\end{itemdecl} |
| 19458 | + |
| 19459 | +\begin{itemdescr} |
| 19460 | +\pnum |
| 19461 | +\effects |
| 19462 | +Equivalent to \tcode{insert_range(rg)}. |
| 19463 | + |
| 19464 | +\pnum |
| 19465 | +\complexity |
| 19466 | +Linear in $N$, where $N$ is \tcode{size()} after the operation. |
| 19467 | +\end{itemdescr} |
| 19468 | + |
19402 | 19469 | \indexlibrarymember{swap}{flat_set}% |
19403 | 19470 | \begin{itemdecl} |
19404 | | -constexpr void swap(flat_set& y) noexcept; |
| 19471 | +constexpr void swap(flat_set& y) |
| 19472 | + noexcept(is_nothrow_swappable_v<container_type> && |
| 19473 | + is_nothrow_swappable_v<key_compare>); |
19405 | 19474 | \end{itemdecl} |
19406 | 19475 |
|
19407 | 19476 | \begin{itemdescr} |
|
19541 | 19610 |
|
19542 | 19611 | \pnum |
19543 | 19612 | If any member function in \ref{flat.multiset.defn} exits via an exception, |
19544 | | -the invariant is restored. |
| 19613 | +the invariant of the object argument is restored. |
| 19614 | +For the move constructor and move assignment operator, |
| 19615 | +the invariants of both arguments are restored. |
19545 | 19616 | \begin{note} |
19546 | 19617 | This can result in the \tcode{flat_multiset}'s being emptied. |
19547 | 19618 | \end{note} |
|
19594 | 19665 | // \ref{flat.multiset.cons}, constructors |
19595 | 19666 | constexpr flat_multiset() : flat_multiset(key_compare()) { } |
19596 | 19667 |
|
| 19668 | + constexpr flat_multiset(const flat_multiset&); |
| 19669 | + constexpr flat_multiset(flat_multiset&&); |
| 19670 | + constexpr flat_multiset& operator=(const flat_multiset&); |
| 19671 | + constexpr flat_multiset& operator=(flat_multiset&&); |
| 19672 | + |
19597 | 19673 | constexpr explicit flat_multiset(const key_compare& comp) |
19598 | 19674 | : @\exposid{c}@(), @\exposid{compare}@(comp) { } |
19599 | 19675 |
|
|
19721 | 19797 | constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last); |
19722 | 19798 | template<@\exposconcept{container-compatible-range}@<value_type> R> |
19723 | 19799 | constexpr void insert_range(R&& rg); |
| 19800 | + template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 19801 | + constexpr void insert_range(sorted_equivalent_t, R&& rg); |
19724 | 19802 |
|
19725 | 19803 | constexpr void insert(initializer_list<value_type> il) |
19726 | 19804 | { insert(il.begin(), il.end()); } |
|
19736 | 19814 | template<class K> constexpr size_type erase(K&& x); |
19737 | 19815 | constexpr iterator erase(const_iterator first, const_iterator last); |
19738 | 19816 |
|
19739 | | - constexpr void swap(flat_multiset& y) noexcept; |
| 19817 | + constexpr void swap(flat_multiset& y) noexcept(@\seebelow@); |
19740 | 19818 | constexpr void clear() noexcept; |
19741 | 19819 |
|
19742 | 19820 | // observers |
|
19777 | 19855 | friend constexpr @\exposid{synth-three-way-result}@<value_type> |
19778 | 19856 | operator<=>(const flat_multiset& x, const flat_multiset& y); |
19779 | 19857 |
|
19780 | | - friend constexpr void swap(flat_multiset& x, flat_multiset& y) noexcept |
| 19858 | + friend constexpr void swap(flat_multiset& x, flat_multiset& y) |
| 19859 | + noexcept(noexcept(x.swap(y))) |
19781 | 19860 | { x.swap(y); } |
19782 | 19861 |
|
19783 | 19862 | private: |
@@ -20024,12 +20103,60 @@ |
20024 | 20103 |
|
20025 | 20104 | \pnum |
20026 | 20105 | \complexity |
20027 | | -Linear. |
| 20106 | +Linear in $N$, where $N$ is \tcode{size()} after the operation. |
| 20107 | +\end{itemdescr} |
| 20108 | + |
| 20109 | +\indexlibrarymember{insert_range}{flat_multiset}% |
| 20110 | +\begin{itemdecl} |
| 20111 | +template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 20112 | + void insert_range(R&& rg); |
| 20113 | +\end{itemdecl} |
| 20114 | + |
| 20115 | +\begin{itemdescr} |
| 20116 | +\pnum |
| 20117 | +\effects |
| 20118 | +Adds elements to \exposid{c} as if by: |
| 20119 | +\begin{codeblock} |
| 20120 | +ranges::for_each(rg, [&](auto&& e) { |
| 20121 | + @\exposid{c}@.insert(@\exposid{c}@.end(), std::forward<decltype(e)>(e)); |
| 20122 | +}); |
| 20123 | +\end{codeblock} |
| 20124 | +Then, sorts the range of newly inserted elements with respect to \exposid{compare}, |
| 20125 | +and merges the resulting sorted range and |
| 20126 | +the sorted range of pre-existing elements into a single sorted range. |
| 20127 | + |
| 20128 | +\pnum |
| 20129 | +\complexity |
| 20130 | +$N$ + $M \log M$, where $N$ is \tcode{size()} before the operation and $M$ |
| 20131 | +is \tcode{ranges::distance(rg)}. |
| 20132 | + |
| 20133 | +\pnum |
| 20134 | +\remarks |
| 20135 | +Since this operation performs an in-place merge, |
| 20136 | +it may allocate memory. |
| 20137 | +\end{itemdescr} |
| 20138 | + |
| 20139 | +\indexlibrarymember{insert_range}{flat_multiset}% |
| 20140 | +\begin{itemdecl} |
| 20141 | +template<@\exposconcept{container-compatible-range}@<value_type> R> |
| 20142 | + constexpr void insert_range(sorted_equivalent_t, R&& rg); |
| 20143 | +\end{itemdecl} |
| 20144 | + |
| 20145 | +\begin{itemdescr} |
| 20146 | +\pnum |
| 20147 | +\effects |
| 20148 | +Equivalent to \tcode{insert_range(rg)}. |
| 20149 | + |
| 20150 | +\pnum |
| 20151 | +\complexity |
| 20152 | +Linear in $N$, where $N$ is \tcode{size()} after the operation. |
20028 | 20153 | \end{itemdescr} |
20029 | 20154 |
|
20030 | 20155 | \indexlibrarymember{swap}{flat_multiset}% |
20031 | 20156 | \begin{itemdecl} |
20032 | | -constexpr void swap(flat_multiset& y) noexcept; |
| 20157 | +constexpr void swap(flat_multiset& y) |
| 20158 | + noexcept(is_nothrow_swappable_v<container_type> && |
| 20159 | + is_nothrow_swappable_v<key_compare>); |
20033 | 20160 | \end{itemdecl} |
20034 | 20161 |
|
20035 | 20162 | \begin{itemdescr} |
|
0 commit comments