![]() |
MySQL 9.6.0
Source Code Documentation
|
Functions | |
| template<class Map_or_set_t , class Source_iterator_t > requires std::convertible_to< mysql::ranges::Iterator_value_type<Source_iterator_t>, mysql::ranges::Range_value_type<Map_or_set_t>> | |
| void | map_or_set_assign (Map_or_set_t &map_or_set, const Source_iterator_t &first, const std::sentinel_for< Source_iterator_t > auto &last) |
Replace the contents of container with that of the range given by the two iterators, minimizing memory allocations. More... | |
| void mysql::containers::throwing::map_or_set_assign | ( | Map_or_set_t & | map_or_set, |
| const Source_iterator_t & | first, | ||
| const std::sentinel_for< Source_iterator_t > auto & | last | ||
| ) |
Replace the contents of container with that of the range given by the two iterators, minimizing memory allocations.
This reuses existing nodes of the target container as far as possible, and allocates new ones only if the source has more nodes than the target container.
It does not copy the allocator.
Informally, this is to std::map what std::vector:assign is to std::vector.
| map_or_set | Container to overwrite. |
| first | Iterator to first element of new contents. |
| last | Iterator to last element of new contents. |
| std::bad_alloc | Out of memory. This can only occur if the source range has more elements than the container. |