Tessil/robin-map

aligned_storage is deprecated by C++23

qdztxc opened this issue · 3 comments

template <typename ValueType, bool StoreHash>
class bucket_entry : public bucket_entry_hash {
using bucket_hash = bucket_entry_hash;

public:
using value_type = ValueType;
using distance_type = std::int16_t;

..................................................................................

private:
using storage = typename std::aligned_storage<sizeof(value_type),
alignof(value_type)>::type;

distance_type m_dist_from_ideal_bucket;
bool m_last_bucket;
storage m_value;
};

visual studio 2022 v17.3.0 preview reported this as error.

Severity Code Description Project File Line Suppression State
Error C4996 'std::aligned_storage<8,4>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)]. You can define _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING or _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS to acknowledge that you have received this warning. MDTest D:\STHFT\3rd\include\tsl\robin_hash.h 334

may change to

private:
distance_type m_dist_from_ideal_bucket;
bool m_last_bucket;
alignas(value_type) std::byte m_value[sizeof(value_type)];

Thanks, I fixed the issue.