为什么 std::aligned_storage 在 C++23 中被弃用以及使用什么替代?
我刚刚看到C ++ 23计划将两者都弃用 std :: aligned_storage 和
std :: aligned_storage_t
以及
std :: Aligned_union
和std :: aligned_union_t
。
据我所知,在对齐存储中的新对象并不是特别constexpr
友好,但这似乎不是完全抛出类型的好理由。这使我假设使用std :: aligned_storage
和我不知道的朋友还有其他一些基本问题。那会是什么?
还有这些类型的拟议替代方案吗?
I just saw that C++23 plans to deprecate both std::aligned_storage
and std::aligned_storage_t
as well as std::aligned_union
and std::aligned_union_t
.
Placement new'd objects in aligned storage are not particularly constexpr
friendly as far as I understand, but that doesn't appear to be a good reason to throw out the type completely. This leads me to assume that there is some other fundamental problem with using std::aligned_storage
and friends that I am not aware of. What would that be?
And is there a proposed alternative to these types?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是
P1413R3
:
上述部分来自已接受的退休
aligned_*
提案,后面是许多示例,例如这两个替换建议:Here are three excerpts from
P1413R3
:The above section from the accepted proposal to retire
aligned_*
is then followed with a number of examples, like these two replacement suggestions: