24#ifndef MYSQL_CONTAINERS_MAP_OR_SET_ASSIGN_H
25#define MYSQL_CONTAINERS_MAP_OR_SET_ASSIGN_H
52 constexpr bool has_value_member =
requires { node_handle.value(); };
54 if constexpr (has_value_member) {
55 node_handle.value() = *iterator;
57 node_handle.key() = iterator->first;
58 node_handle.mapped() = iterator->second;
65template <
class Map_or_set_t>
67 constexpr bool has_key_comparison_member =
68 requires { map_or_set.key_comp(); };
69 if constexpr (has_key_comparison_member) {
72 return Map_or_set_t(map_or_set.key_comp(), map_or_set.get_allocator());
76 return Map_or_set_t(map_or_set.get_allocator());
103template <
class Map_or_set_t,
class Source_iterator_t>
104 requires std::convertible_to<
108 const std::sentinel_for<Source_iterator_t>
auto &last) {
113 for (; it != last && !map_or_set.empty(); ++it) {
114 auto node_handle = map_or_set.extract(map_or_set.begin());
116 tmp.insert(tmp.cend(), std::move(node_handle));
120 map_or_set = std::move(tmp);
123 for (; it != last; ++it) {
124 map_or_set.insert(map_or_set.cend(), *it);
153template <
class Source_iterator_t>
155 auto &map_or_set,
const Source_iterator_t &first,
156 const std::sentinel_for<Source_iterator_t>
auto &last)
noexcept {
157 return mysql::utils::call_and_catch(
Definition: map_or_set_assign.h:82
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,...
Definition: map_or_set_assign.h:107
Definition: basic_container_wrapper.h:42
void node_handle_assign(auto &node_handle, auto &iterator) noexcept
For a node_handle retrieved from the extract member of one of the std::[unordered_][multi]{set|map} c...
Definition: map_or_set_assign.h:49
auto make_empty_map_or_set_and_copy_metadata(const Map_or_set_t &map_or_set)
Return a new object of the same type as the parameter, without any elements, with the same allocator,...
Definition: map_or_set_assign.h:66
auto map_or_set_assign(auto &map_or_set, const Source_iterator_t &first, const std::sentinel_for< Source_iterator_t > auto &last) noexcept
Replace the contents of container with that of the range given by the two iterators,...
Definition: map_or_set_assign.h:154
std::remove_cvref_t< decltype(*std::declval< Iterator_t >())> Iterator_value_type
Gives the value type for any iterator type, deduced from operator *.
Definition: meta.h:63
Iterator_value_type< Range_iterator_type< Range_t > > Range_value_type
Gives the value type for any collection, deduced from *begin().
Definition: meta.h:67