Skip to content

Commit 3964653

Browse files
committed
Remove aligned_storage and the _t bug, closes #19
Argh, `_t`, now I see the typo-that-compiles. Yup, that's too subtle, and as was pointed out `aligned_storage` is deprecated in C++23... I'm convinced now
1 parent 070b75c commit 3964653

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/cpp2util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ using in =
384384
template<typename T>
385385
class deferred_init {
386386
bool init = false;
387-
std::aligned_storage<sizeof(T), alignof(T)> data; // or: alignas(T) std::byte data[sizeof(T)];
387+
alignas(T) std::byte data[sizeof(T)]; // or: std::aligned_storage_t<sizeof(T), alignof(T)> data
388388

389389
auto t() -> T& { return *std::launder(reinterpret_cast<T*>(&data)); }
390390

0 commit comments

Comments
 (0)