tmp/tmpdhy329jo/{from.md → to.md}
RENAMED
|
@@ -1,113 +1,34 @@
|
|
| 1 |
#### Constructors <a id="flat.map.cons">[[flat.map.cons]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
flat_map(key_container_type key_cont, mapped_container_type mapped_cont,
|
| 5 |
const key_compare& comp = key_compare());
|
| 6 |
```
|
| 7 |
|
| 8 |
-
*Effects:* Initializes `c.keys` with `std::move(key_cont)`,
|
| 9 |
-
with `std::move(mapped_cont)`, and
|
| 10 |
-
range \[`begin()`, `end()`) with respect to `value_comp()`;
|
| 11 |
-
erases the duplicate elements as if by:
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
-
auto zv =
|
| 15 |
-
auto it = ranges::unique(zv,
|
| 16 |
auto dist = distance(zv.begin(), it);
|
| 17 |
c.keys.erase(c.keys.begin() + dist, c.keys.end());
|
| 18 |
c.values.erase(c.values.begin() + dist, c.values.end());
|
| 19 |
```
|
| 20 |
|
| 21 |
*Complexity:* Linear in N if the container arguments are already sorted
|
| 22 |
with respect to `value_comp()` and otherwise N log N, where N is the
|
| 23 |
value of `key_cont.size()` before this call.
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
-
|
| 27 |
-
flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
|
| 28 |
-
const Allocator& a);
|
| 29 |
-
template<class Allocator>
|
| 30 |
-
flat_map(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
|
| 31 |
-
const key_compare& comp, const Allocator& a);
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
*Constraints:* `uses_allocator_v<key_container_type, Allocator>` is
|
| 35 |
-
`true` and `uses_allocator_v<mapped_container_type, Allocator>` is
|
| 36 |
-
`true`.
|
| 37 |
-
|
| 38 |
-
*Effects:* Equivalent to `flat_map(key_cont, mapped_cont)` and
|
| 39 |
-
`flat_map(key_cont, mapped_cont, comp)`, respectively, except that
|
| 40 |
-
`c.keys` and `c.values` are constructed with uses-allocator
|
| 41 |
-
construction [[allocator.uses.construction]].
|
| 42 |
-
|
| 43 |
-
*Complexity:* Same as `flat_map(key_cont, mapped_cont)` and
|
| 44 |
-
`flat_map(key_cont, mapped_cont, comp)`, respectively.
|
| 45 |
-
|
| 46 |
-
``` cpp
|
| 47 |
-
flat_map(sorted_unique_t, key_container_type key_cont, mapped_container_type mapped_cont,
|
| 48 |
const key_compare& comp = key_compare());
|
| 49 |
```
|
| 50 |
|
| 51 |
-
*Effects:* Initializes `c.keys` with `std::move(key_cont)`,
|
| 52 |
-
with `std::move(mapped_cont)`, and
|
| 53 |
|
| 54 |
*Complexity:* Constant.
|
| 55 |
|
| 56 |
-
``` cpp
|
| 57 |
-
template<class Allocator>
|
| 58 |
-
flat_map(sorted_unique_t s, const key_container_type& key_cont,
|
| 59 |
-
const mapped_container_type& mapped_cont, const Allocator& a);
|
| 60 |
-
template<class Allocator>
|
| 61 |
-
flat_map(sorted_unique_t s, const key_container_type& key_cont,
|
| 62 |
-
const mapped_container_type& mapped_cont, const key_compare& comp,
|
| 63 |
-
const Allocator& a);
|
| 64 |
-
```
|
| 65 |
-
|
| 66 |
-
*Constraints:* `uses_allocator_v<key_container_type, Allocator>` is
|
| 67 |
-
`true` and `uses_allocator_v<mapped_container_type, Allocator>` is
|
| 68 |
-
`true`.
|
| 69 |
-
|
| 70 |
-
*Effects:* Equivalent to `flat_map(s, key_cont, mapped_cont)` and
|
| 71 |
-
`flat_map(s, key_cont, mapped_cont, comp)`, respectively, except that
|
| 72 |
-
`c.keys` and `c.values` are constructed with uses-allocator
|
| 73 |
-
construction [[allocator.uses.construction]].
|
| 74 |
-
|
| 75 |
-
*Complexity:* Linear.
|
| 76 |
-
|
| 77 |
-
``` cpp
|
| 78 |
-
template<class Allocator>
|
| 79 |
-
flat_map(const key_compare& comp, const Allocator& a);
|
| 80 |
-
template<class Allocator>
|
| 81 |
-
explicit flat_map(const Allocator& a);
|
| 82 |
-
template<class InputIterator, class Allocator>
|
| 83 |
-
flat_map(InputIterator first, InputIterator last, const key_compare& comp, const Allocator& a);
|
| 84 |
-
template<class InputIterator, class Allocator>
|
| 85 |
-
flat_map(InputIterator first, InputIterator last, const Allocator& a);
|
| 86 |
-
template<container-compatible-range<value_type> R, class Allocator>
|
| 87 |
-
flat_map(from_range_t, R&& rg, const Allocator& a);
|
| 88 |
-
template<container-compatible-range<value_type> R, class Allocator>
|
| 89 |
-
flat_map(from_range_t, R&& rg, const key_compare& comp, const Allocator& a);
|
| 90 |
-
template<class InputIterator, class Allocator>
|
| 91 |
-
flat_map(sorted_unique_t, InputIterator first, InputIterator last,
|
| 92 |
-
const key_compare& comp, const Allocator& a);
|
| 93 |
-
template<class InputIterator, class Allocator>
|
| 94 |
-
flat_map(sorted_unique_t, InputIterator first, InputIterator last, const Allocator& a);
|
| 95 |
-
template<class Allocator>
|
| 96 |
-
flat_map(initializer_list<value_type> il, const key_compare& comp, const Allocator& a);
|
| 97 |
-
template<class Allocator>
|
| 98 |
-
flat_map(initializer_list<value_type> il, const Allocator& a);
|
| 99 |
-
template<class Allocator>
|
| 100 |
-
flat_map(sorted_unique_t, initializer_list<value_type> il,
|
| 101 |
-
const key_compare& comp, const Allocator& a);
|
| 102 |
-
template<class Allocator>
|
| 103 |
-
flat_map(sorted_unique_t, initializer_list<value_type> il, const Allocator& a);
|
| 104 |
-
```
|
| 105 |
-
|
| 106 |
-
*Constraints:* `uses_allocator_v<key_container_type, Allocator>` is
|
| 107 |
-
`true` and `uses_allocator_v<mapped_container_type, Allocator>` is
|
| 108 |
-
`true`.
|
| 109 |
-
|
| 110 |
-
*Effects:* Equivalent to the corresponding non-allocator constructors
|
| 111 |
-
except that `c.keys` and `c.values` are constructed with uses-allocator
|
| 112 |
-
construction [[allocator.uses.construction]].
|
| 113 |
-
|
|
|
|
| 1 |
#### Constructors <a id="flat.map.cons">[[flat.map.cons]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
constexpr flat_map(key_container_type key_cont, mapped_container_type mapped_cont,
|
| 5 |
const key_compare& comp = key_compare());
|
| 6 |
```
|
| 7 |
|
| 8 |
+
*Effects:* Initializes *`c`*`.keys` with `std::move(key_cont)`,
|
| 9 |
+
*`c`*`.values` with `std::move(mapped_cont)`, and *compare* with `comp`;
|
| 10 |
+
sorts the range \[`begin()`, `end()`) with respect to `value_comp()`;
|
| 11 |
+
and finally erases the duplicate elements as if by:
|
| 12 |
|
| 13 |
``` cpp
|
| 14 |
+
auto zv = views::zip(c.keys, c.values);
|
| 15 |
+
auto it = ranges::unique(zv, key-equiv(compare)).begin();
|
| 16 |
auto dist = distance(zv.begin(), it);
|
| 17 |
c.keys.erase(c.keys.begin() + dist, c.keys.end());
|
| 18 |
c.values.erase(c.values.begin() + dist, c.values.end());
|
| 19 |
```
|
| 20 |
|
| 21 |
*Complexity:* Linear in N if the container arguments are already sorted
|
| 22 |
with respect to `value_comp()` and otherwise N log N, where N is the
|
| 23 |
value of `key_cont.size()` before this call.
|
| 24 |
|
| 25 |
``` cpp
|
| 26 |
+
constexpr flat_map(sorted_unique_t, key_container_type key_cont, mapped_container_type mapped_cont,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
const key_compare& comp = key_compare());
|
| 28 |
```
|
| 29 |
|
| 30 |
+
*Effects:* Initializes *`c`*`.keys` with `std::move(key_cont)`,
|
| 31 |
+
*`c`*`.values` with `std::move(mapped_cont)`, and *compare* with `comp`.
|
| 32 |
|
| 33 |
*Complexity:* Constant.
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|