Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aligned_storage is deprecated by C++23 #57

Closed
qdztxc opened this issue Aug 5, 2022 · 3 comments
Closed

aligned_storage is deprecated by C++23 #57

qdztxc opened this issue Aug 5, 2022 · 3 comments

Comments

@qdztxc
Copy link

qdztxc commented Aug 5, 2022

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

@qdztxc
Copy link
Author

qdztxc commented Aug 5, 2022

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)];

@qdztxc
Copy link
Author

qdztxc commented Aug 5, 2022

reference:
https://www.editcode.net/ask/245020.html

@Tessil
Copy link
Owner

Tessil commented Dec 18, 2022

Thanks, I fixed the issue.

@Tessil Tessil closed this as completed Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants