相关疑难解决方法(0)

为什么 std::aligned_storage 在 C++23 中被弃用以及使用什么替代?

我刚刚看到 C++ 23计划弃用std::aligned_storageandstd::aligned_storage_t以及std::aligned_unionstd::aligned_union_t

据我所知,在对齐存储中放置新对象并不是特别constexpr友好,但这似乎不是完全丢弃该类型的好理由。这让我假设使用std::aligned_storage和朋友还存在一些我不知道的其他基本问题。那会是什么?

是否有建议替代这些类型?

c++ memory-alignment deprecated c++23

62
推荐指数
1
解决办法
8658
查看次数

标签 统计

c++ ×1

c++23 ×1

deprecated ×1

memory-alignment ×1