tmp/tmpq9nw_7go/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Overview <a id="flat.map.overview">[[flat.map.overview]]</a>
|
| 2 |
+
|
| 3 |
+
A `flat_map` is a container adaptor that provides an associative
|
| 4 |
+
container interface that supports unique keys (i.e., contains at most
|
| 5 |
+
one of each key value) and provides for fast retrieval of values of
|
| 6 |
+
another type `T` based on the keys. `flat_map` supports iterators that
|
| 7 |
+
meet the *Cpp17InputIterator* requirements and model the
|
| 8 |
+
`random_access_iterator` concept [[iterator.concept.random.access]].
|
| 9 |
+
|
| 10 |
+
A `flat_map` meets all of the requirements of a container
|
| 11 |
+
[[container.reqmts]] and of a reversible container
|
| 12 |
+
[[container.rev.reqmts]], plus the optional container requirements
|
| 13 |
+
[[container.opt.reqmts]]. `flat_map` meets the requirements of an
|
| 14 |
+
associative container [[associative.reqmts]], except that:
|
| 15 |
+
|
| 16 |
+
- it does not meet the requirements related to node handles
|
| 17 |
+
[[container.node]],
|
| 18 |
+
- it does not meet the requirements related to iterator invalidation,
|
| 19 |
+
and
|
| 20 |
+
- the time complexity of the operations that insert or erase a single
|
| 21 |
+
element from the map is linear, including the ones that take an
|
| 22 |
+
insertion position iterator.
|
| 23 |
+
|
| 24 |
+
[*Note 1*: A `flat_map` does not meet the additional requirements of an
|
| 25 |
+
allocator-aware container [[container.alloc.reqmts]]. — *end note*]
|
| 26 |
+
|
| 27 |
+
A `flat_map` also provides most operations described in
|
| 28 |
+
[[associative.reqmts]] for unique keys. This means that a `flat_map`
|
| 29 |
+
supports the `a_uniq` operations in [[associative.reqmts]] but not the
|
| 30 |
+
`a_eq` operations. For a `flat_map<Key, T>` the `key_type` is `Key` and
|
| 31 |
+
the `value_type` is `pair<Key, T>`.
|
| 32 |
+
|
| 33 |
+
Descriptions are provided here only for operations on `flat_map` that
|
| 34 |
+
are not described in one of those sets of requirements or for operations
|
| 35 |
+
where there is additional semantic information.
|
| 36 |
+
|
| 37 |
+
A `flat_map` maintains the following invariants:
|
| 38 |
+
|
| 39 |
+
- it contains the same number of keys and values;
|
| 40 |
+
- the keys are sorted with respect to the comparison object; and
|
| 41 |
+
- the value at offset `off` within the value container is the value
|
| 42 |
+
associated with the key at offset `off` within the key container.
|
| 43 |
+
|
| 44 |
+
If any member function in [[flat.map.defn]] exits via an exception the
|
| 45 |
+
invariants are restored.
|
| 46 |
+
|
| 47 |
+
[*Note 2*: This can result in the `flat_map` being
|
| 48 |
+
emptied. — *end note*]
|
| 49 |
+
|
| 50 |
+
Any type `C` that meets the sequence container requirements
|
| 51 |
+
[[sequence.reqmts]] can be used to instantiate `flat_map`, as long as
|
| 52 |
+
`C::iterator` meets the *Cpp17RandomAccessIterator* requirements and
|
| 53 |
+
invocations of member functions `C::size` and `C::max_size` do not exit
|
| 54 |
+
via an exception. In particular, `vector` [[vector]] and `deque`
|
| 55 |
+
[[deque]] can be used.
|
| 56 |
+
|
| 57 |
+
[*Note 3*: `vector<bool>` is not a sequence container. — *end note*]
|
| 58 |
+
|
| 59 |
+
The program is ill-formed if `Key` is not the same type as
|
| 60 |
+
`KeyContainer::value_type` or `T` is not the same type as
|
| 61 |
+
`MappedContainer::value_type`.
|
| 62 |
+
|
| 63 |
+
The effect of calling a constructor that takes both `key_container_type`
|
| 64 |
+
and `mapped_container_type` arguments with containers of different sizes
|
| 65 |
+
is undefined.
|
| 66 |
+
|
| 67 |
+
The effect of calling a constructor or member function that takes a
|
| 68 |
+
`sorted_unique_t` argument with a container, containers, or range that
|
| 69 |
+
is not sorted with respect to `key_comp()`, or that contains equal
|
| 70 |
+
elements, is undefined.
|
| 71 |
+
|