do not use deprecated std::aligned_storage

This commit is contained in:
Daniel Kolesa 2022-04-21 04:15:31 +02:00
parent 12bd267efc
commit b430cf7c83

View file

@ -61,7 +61,7 @@ private:
size_t asize; size_t asize;
}; };
std::aligned_storage_t<sizeof(void *) * 4> p_stor; alignas(std::max_align_t) unsigned char p_stor[sizeof(void *) * 4];
base *p_func; base *p_func;
static inline base *as_base(void *p) { static inline base *as_base(void *p) {
@ -170,7 +170,7 @@ public:
} }
void swap(callable &f) noexcept { void swap(callable &f) noexcept {
std::aligned_storage_t<sizeof(p_stor)> tmp_stor; alignas(std::max_align_t) unsigned char tmp_stor[sizeof(p_stor)];
if (small_storage() && f.small_storage()) { if (small_storage() && f.small_storage()) {
auto *t = as_base(&tmp_stor); auto *t = as_base(&tmp_stor);
p_func->move_to(t); p_func->move_to(t);