更多constexpr容器是否需要mark_immutable_if_consexpr

Is mark_immutable_if_constexpr needed for more constexpr containers?

本文关键字:mark immutable if consexpr constexpr 是否 更多      更新时间:2023-10-16

已接受的C++20提案"More constexpr containers"(P0784(中的第一个代码示例使用了函数std::mark_immutable_if_constexpr。该职能是否被接受为同一提案的一部分?我在这里看到,GCC 10在一组名为"放宽constexpr限制"的提案中支持P0784,但std::mark_immutable_if_constexpr不包括在GCC 10中。std::mark_immutable_if_constexpr是否需要使用P0784?

该函数是否被接受为同一提案的一部分?

函数mark_immutable_if_constexpr不在建议中,也不在C++20中。它被从早期的草案中删除:

删除非瞬态分配处理,因为EWG不喜欢mark_immutable_if_constexpr,并且R4现状的问题可能很难发展。

您还可以看到,论文的措辞并没有引入这一新功能。