Files
2025-10-25 03:02:53 +03:00

2.0 KiB
Raw Permalink Blame History

[flat.map.cons]

23 Containers library [containers]

23.6 Container adaptors [container.adaptors]

23.6.8 Class template flat_map [flat.map]

23.6.8.3 Constructors [flat.map.cons]

🔗

constexpr flat_map(key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare());

1

#

Effects: Initializesc.keys with std::move(key_cont),c.values with std::move(mapped_cont), andcompare with comp; sorts the range [begin(), end()) with respect to value_comp(); and finally erases the duplicate elements as if by:auto zv = views::zip(c.keys, c.values);auto it = ranges::unique(zv, key-equiv(compare)).begin();auto dist = distance(zv.begin(), it);c.keys.erase(c.keys.begin() + dist, c.keys.end());c.values.erase(c.values.begin() + dist, c.values.end());

2

#

Complexity: Linear in N if the container arguments are already sorted with respect to value_comp() and otherwise NlogN, where N is the value of key_cont.size() before this call.

🔗

constexpr flat_map(sorted_unique_t, key_container_type key_cont, mapped_container_type mapped_cont, const key_compare& comp = key_compare());

3

#

Effects: Initializesc.keys with std::move(key_cont),c.values with std::move(mapped_cont), andcompare with comp.

4

#

Complexity: Constant.