gpt4 book ai didi

c++ - 项目符号 [dcl.init]/7 (7.1)

转载 作者:行者123 更新时间:2023-11-30 01:07:18 24 4
gpt4 key购买 nike

我明白了[dcl.init]/7 (7.1)由于 DR 1630,相对于 C++14 进行了更改.但是 C++14 中突出显示的句子(见下文)不应该继续存在于 C++1z 中吗?

[dcl.init]/7 (7.1):

If T is a (possibly cv-qualified) class type (Clause 12), constructors are considered. The applicable constructors are enumerated (16.3.1.3), and the best one for the initializer () is chosen through overload resolution (16.3). The constructor thus selected is called, with an empty argument list, to initialize the object.

C++14 中的[dcl.init]/7 (7.1)(重点是我的):

if T is a (possibly cv-qualified) class type (Clause 9), the default constructor (12.1) for T is called (and the initialization is ill-formed if T has no default constructor or overload resolution (13.3) results in an ambiguity or in a function that is deleted or inaccessible from the context of the initialization);

最佳答案

... and the best one for the initializer () is chosen through overload resolution ...

过载解析已经暗示了所有被删除的内容。使用旧的措辞,在没有提到限制的情况下,它可以被理解为隐含地允许调用不可访问的默认构造函数,但使用新的措辞,通过简单地指定适用通常的规则就已经很清楚了。

关于c++ - 项目符号 [dcl.init]/7 (7.1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44853774/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com