是否需要更多constexpr容器使用mark_immutable_if_constexpr?

问题描述 投票:0回答:1

接受的C ++ 20提案“更多constexpr容器”(P0784)中的第一个代码示例使用函数std::mark_immutable_if_constexpr。该功能是否被接受为同一提案的一部分?我看到here GCC 10在一组标有“放松constexpr限制的提议”中支持P0784,但是std::mark_immutable_if_constexpr不包含在GCC 10中。使用P0784是否需要std::mark_immutable_if_constexpr

c++ constexpr c++20
1个回答
3
投票

该功能是否被接受为同一提案的一部分?

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

由于EWG不喜欢mark_immutable_if_constexpr,并且可能难以解决R4现状的问题,因此删除非临时分配处理。

您还可以看到本文的措辞没有引入此新功能。

© www.soinside.com 2019 - 2024. All rights reserved.