@@ -1068,7 +1068,7 @@ namespace hud
10681068
10691069 if constexpr (hud::allocator_traits<allocator_type>::swap_when_container_swap::value)
10701070 {
1071- hud::swap (hud::get< 0 >(compressed_ ), hud::get< 0 >( other.compressed_ ));
1071+ hud::swap (allocator_mut ( ), other.allocator_mut ( ));
10721072 }
10731073
10741074 hud::swap (other.count_ , count_);
@@ -1444,7 +1444,7 @@ namespace hud
14441444 // Copy the allocator if copy_when_container_copy_assigned is true
14451445 if constexpr (hud::is_not_same_v<u_allocator_t , allocator_type> || hud::allocator_traits<allocator_t >::copy_when_container_copy_assigned::value)
14461446 {
1447- hud::get< 0 >(compressed_ ) = hud::get< 0 >( other.compressed_ );
1447+ allocator_mut ( ) = other.allocator ( );
14481448 }
14491449 // Copy the number of element
14501450 count_ = other.count_ ;
@@ -1459,7 +1459,7 @@ namespace hud
14591459 // Copy the allocator if copy_when_container_copy_assigned is true
14601460 if constexpr (hud::is_not_same_v<u_allocator_t , allocator_type> || hud::allocator_traits<allocator_t >::copy_when_container_copy_assigned::value)
14611461 {
1462- hud::get< 0 >(compressed_ ) = hud::get< 0 >( other.compressed_ );
1462+ allocator_mut ( ) = other.allocator ( );
14631463 }
14641464 // Copy the number of element
14651465 count_ = other.count_ ;
@@ -1520,7 +1520,7 @@ namespace hud
15201520 // Copy the allocator if copy_when_container_copy_assigned is true
15211521 if constexpr (hud::is_not_same_v<u_allocator_t , allocator_type> || hud::allocator_traits<allocator_t >::copy_when_container_copy_assigned::value)
15221522 {
1523- hud::get< 0 >(compressed_ ) = hud::move (hud::get< 0 >( other.compressed_ ));
1523+ allocator_mut ( ) = hud::move (other.allocator_mut ( ));
15241524 }
15251525 // Copy the number of element
15261526 count_ = other.count_ ;
@@ -1535,7 +1535,7 @@ namespace hud
15351535 // Copy the allocator if copy_when_container_copy_assigned is true
15361536 if constexpr (hud::is_not_same_v<u_allocator_t , allocator_type> || hud::allocator_traits<allocator_t >::copy_when_container_copy_assigned::value)
15371537 {
1538- hud::get< 0 >(compressed_ ) = hud::move (hud::get< 0 >( other.compressed_ ));
1538+ allocator_mut ( ) = hud::move (other.allocator_mut ( ));
15391539 }
15401540 // Copy the number of element
15411541 count_ = other.count_ ;
@@ -1578,7 +1578,7 @@ namespace hud
15781578 // Move allocator and move members
15791579 if constexpr (hud::is_not_same_v<u_allocator_t , allocator_type> || hud::allocator_traits<allocator_t >::move_when_container_move_assigned::value)
15801580 {
1581- hud::get< 0 >(compressed_ ) = hud::move (hud::get< 0 >( other.compressed_ ));
1581+ allocator_mut ( ) = hud::move (other.allocator_mut ( ));
15821582 }
15831583 control_ptr_ = other.control_ptr_ ;
15841584 other.control_ptr_ = const_cast <control_type *>(&INIT_GROUP [16 ]);
@@ -1854,14 +1854,14 @@ namespace hud
18541854
18551855 if (hud::is_constant_evaluated ())
18561856 {
1857- control_ptr_ = hud::get< 0 >(compressed_ ).template allocate <control_type>(control_size).data ();
1858- slot_ptr_ = hud::get< 0 >(compressed_ ).template allocate <slot_type>(slots_size).data ();
1857+ control_ptr_ = allocator_mut ( ).template allocate <control_type>(control_size).data ();
1858+ slot_ptr_ = allocator_mut ( ).template allocate <slot_type>(slots_size).data ();
18591859 }
18601860 else
18611861 {
18621862 // Allocate control, slot, and slot size to satisfy slot_ptr_ alignment requirements
18631863 const usize aligned_allocation_size {control_size + sizeof (slot_type) + slots_size};
1864- control_ptr_ = hud::get< 0 >(compressed_ ).template allocate <control_type>(aligned_allocation_size).data ();
1864+ control_ptr_ = allocator_mut ( ).template allocate <control_type>(aligned_allocation_size).data ();
18651865 slot_ptr_ = reinterpret_cast <slot_type *>(hud::memory::align_address (reinterpret_cast <const uptr>(control_ptr_ + control_size), sizeof (slot_type)));
18661866 hud::check (hud::memory::is_pointer_aligned (slot_ptr_, alignof (slot_type)));
18671867 }
@@ -1879,13 +1879,13 @@ namespace hud
18791879 // and allocation is done in two separate allocation
18801880 if (hud::is_constant_evaluated ())
18811881 {
1882- hud::get< 0 >(compressed_ ).template free <control_type>({control_ptr, control_size});
1883- hud::get< 0 >(compressed_ ).template free <slot_type>({slot_ptr, slots_size});
1882+ allocator_mut ( ).template free <control_type>({control_ptr, control_size});
1883+ allocator_mut ( ).template free <slot_type>({slot_ptr, slots_size});
18841884 }
18851885 else
18861886 {
18871887 const usize aligned_allocation_size {control_size + sizeof (slot_type) + slots_size};
1888- hud::get< 0 >(compressed_ ).template free <control_type>({control_ptr, aligned_allocation_size});
1888+ allocator_mut ( ).template free <control_type>({control_ptr, aligned_allocation_size});
18891889 }
18901890 }
18911891 }
@@ -1961,6 +1961,11 @@ namespace hud
19611961 return hud::get<1 >(compressed_);
19621962 }
19631963
1964+ [[nodiscard]] constexpr allocator_type &allocator_mut () noexcept
1965+ {
1966+ return hud::get<0 >(compressed_);
1967+ }
1968+
19641969 private:
19651970 /* * Max count of slot in the map. Always a power of two mask value. */
19661971 usize max_slot_count_ {0 };
0 commit comments