【发布时间】:2013-12-05 20:02:11
【问题描述】:
在第 3.8.1 节的 n3690 C++ 标准中有这样的文字:
The lifetime of an object of type T begins when:
— storage with the proper alignment and size for type T is obtained, and
— if the object has non-trivial initialization, its initialization is complete.
假设有一个用户定义的构造函数。
最后一句是什么意思?是在初始化列表完成初始化还是在构造函数主体完成运行时?还是最后一句话有别的意思?
【问题讨论】:
-
构造函数体运行完毕。
-
好的,但是你怎么知道的?我的意思是我怎么能读到构造函数体已经从“,它的初始化完成了”运行?
-
在构造函数调用之后的下一条语句完成。
-
我确定你是对的,但我很好奇,你是怎么知道的?
-
你是在问标准在哪里说运行构造函数算作初始化?
标签: c++ standards language-lawyer