std::aligned_storage is deprecated in c++ 23
I recently tried to use c++ 23 to write some code and found compiler gave me some warning that std::align_storage is deprecated.
According to the comment, it can use alignas with std::byte (or unsigned char i think) to replace
/**
* @deprecated Deprecated in C++23. Uses can be replaced by an
* array std::byte[_Len] declared with alignas(_Align).
*/
So, it can be like:
// typename std::aligned_storage<element_size (), alignment ()>::type m_data[num_elements ()];
struct alignas(alignment()) {
std::byte _data[element_size()];
} m_data[num_elements()];
No sure whether it is compatible
Thanks for the report NengJie, and nice suggestion. I'll probably go with something like that but instead use unsigned char instead of std::byte for compatibility with < C++17.
Looks like I have to start testing with 23.
Sorry for the long delay. I'm guessing that you closed this because you saw that I finally got around to it on my working branch. In case you didn't, I just merged the fix to main.
Sorry for the long delay. I'm guessing that you closed this because you saw that I finally got around to it on my working branch. In case you didn't, I just merged the fix to
main.
yea, i had seen that 👍