@@ -598,24 +598,18 @@ class segmented_vector {
598598 : m_blocks(vec_alloc(alloc)) {}
599599
600600 segmented_vector (segmented_vector&& other, Allocator alloc)
601- : m_blocks(vec_alloc(alloc)) {
602- if (other.get_allocator () == alloc) {
603- *this = std::move (other);
604- } else {
605- // Oh my, allocator is different so we need to copy everything.
606- append_everything_from (std::move (other));
607- }
601+ : segmented_vector(alloc) {
602+ *this = std::move (other);
608603 }
609604
610- segmented_vector (segmented_vector&& other) noexcept
611- : m_blocks(std::move(other.m_blocks))
612- , m_size(std::exchange(other.m_size, {})) {}
613-
614605 segmented_vector (segmented_vector const & other, Allocator alloc)
615606 : m_blocks(vec_alloc(alloc)) {
616607 append_everything_from (other);
617608 }
618609
610+ segmented_vector (segmented_vector&& other) noexcept
611+ : segmented_vector(std::move(other), get_allocator()) {}
612+
619613 segmented_vector (segmented_vector const & other) {
620614 append_everything_from (other);
621615 }
@@ -632,8 +626,12 @@ class segmented_vector {
632626 auto operator =(segmented_vector&& other) noexcept -> segmented_vector& {
633627 clear ();
634628 dealloc ();
635- m_blocks = std::move (other.m_blocks );
636- m_size = std::exchange (other.m_size , {});
629+ if (other.get_allocator () == get_allocator ()) {
630+ m_blocks = std::move (other.m_blocks );
631+ m_size = std::exchange (other.m_size , {});
632+ } else {
633+ append_everything_from (std::move (other));
634+ }
637635 return *this ;
638636 }
639637
@@ -1169,15 +1167,8 @@ class table : public std::conditional_t<is_map_v<T>, base_table_type_map<T>, bas
11691167 : table(std::move(other), other.m_values.get_allocator()) {}
11701168
11711169 table (table&& other, allocator_type const & alloc) noexcept
1172- : m_values(std::move(other.m_values), alloc)
1173- , m_buckets(std::exchange(other.m_buckets, nullptr ))
1174- , m_num_buckets(std::exchange(other.m_num_buckets, 0 ))
1175- , m_max_bucket_capacity(std::exchange(other.m_max_bucket_capacity, 0 ))
1176- , m_max_load_factor(std::exchange(other.m_max_load_factor, default_max_load_factor))
1177- , m_hash(std::exchange(other.m_hash, {}))
1178- , m_equal(std::exchange(other.m_equal, {}))
1179- , m_shifts(std::exchange(other.m_shifts, initial_shifts)) {
1180- other.m_values .clear ();
1170+ : m_values(alloc) {
1171+ *this = std::move (other);
11811172 }
11821173
11831174 table (std::initializer_list<value_type> ilist,
0 commit comments