diff --git a/include/sg14/hive.h b/include/sg14/hive.h index f13cf6d..de13767 100644 --- a/include/sg14/hive.h +++ b/include/sg14/hive.h @@ -54,7 +54,6 @@ #include #if __cplusplus >= 202002L -#include #include #include #include @@ -178,15 +177,13 @@ class hive { NextAndPrev s_; T t_; }; - PtrOf t() { return bitcast_pointer>(std::addressof(t_)); } + PtrOf t() { return cast_pointer>(std::addressof(t_)); } ~overaligned_elt() = delete; }; template - static constexpr D bitcast_pointer(S source_pointer) { -#if __cpp_lib_bit_cast >= 201806L && __cpp_lib_to_address >= 201711L - return std::bit_cast(std::to_address(source_pointer)); -#elif __cpp_lib_to_address >= 201711L + static D cast_pointer(S source_pointer) { +#if __cpp_lib_to_address >= 201711L return reinterpret_cast(std::to_address(source_pointer)); #else return reinterpret_cast(source_pointer); // reject fancy pointer types @@ -1135,7 +1132,7 @@ class hive { size_t n = (bytes_for_group + bytes_for_elts + bytes_for_skipfield + sizeof(type) - 1) / sizeof(type); PtrOf p = std::allocator_traits>::allocate(ta, n); GroupPtr g = PtrOf(p); - ::new (bitcast_pointer(g)) group(cap); + ::new (cast_pointer(g)) group(cap); return g; } static void deallocate_group(allocator_type a, GroupPtr g) {