mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-24 12:03:29 +01:00
ObjectStorage: port away from std::aligned_storage
It's deprecated in C++23. Just use alignas on a char array, wrapped in a struct to avoid decaying to char*, which is the canonical implementation of aligned_storage: https://en.cppreference.com/w/cpp/types/aligned_storage#Possible_implementation Fixes #2419 Catch3 is not affected.
This commit is contained in:
parent
d71b4617e9
commit
ca455815fd
@ -19,8 +19,6 @@ namespace Catch {
|
|||||||
template <typename T, bool Destruct>
|
template <typename T, bool Destruct>
|
||||||
struct ObjectStorage
|
struct ObjectStorage
|
||||||
{
|
{
|
||||||
using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type;
|
|
||||||
|
|
||||||
ObjectStorage() : data() {}
|
ObjectStorage() : data() {}
|
||||||
|
|
||||||
ObjectStorage(const ObjectStorage& other)
|
ObjectStorage(const ObjectStorage& other)
|
||||||
@ -64,7 +62,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TStorage data;
|
struct { alignas(T) unsigned char data[sizeof(T)]; } data;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user