[英]Where is the original of the statement “the most derived class's ctor needs to directly call the virtual base class's ctor”?
While I learn how to implement a final class in C++, I find such a statement: 当我学习如何在C ++中实现最终类时,我发现了这样一条语句:
"the most derived class's ctor needs to directly call the virtual base class's ctor." “最派生类的ctor需要直接调用虚拟基类的ctor。”
However, I can't find the original of the statement in the C++ standard. 但是,我在C ++标准中找不到该语句的原始内容。 (N3126) (N3126)
Who can tell me the exact page number? 谁能告诉我确切的页码?
Thanks in advance. 提前致谢。
In C++03, it's § 12.6.2 5 在C ++ 03中,它是§12.6.2 5
Initialization shall proceed in the following order: 初始化应按以下顺序进行:
— First, and only for the constructor of the most derived class as described below, virtual base classes shall be initialized in the order they appear on a depth-first left-to-right traversal of the directed acyclic graph of base classes, where “left-to-right” is the order of appearance of the base class names in the derived class base-specifier-list. —首先,并且仅对于如下所述的最大派生类的构造函数,虚拟基类应按照它们在基类的有向无环图的深度优先从左到右遍历时出现的顺序进行初始化,其中“ “从左到右”是基类名称在派生类base-specifier-list中的出现顺序。
... ...
In the current draft for C++0x (N3126), it's § 12.6.2 10, which is page 270: 在C ++ 0x(N3126)的当前草案中,它是§12.6.2 10,即第270页:
In a non-delegating constructor, initialization proceeds in the following order: 在非委托构造函数中,初始化按以下顺序进行:
— First, and only for the constructor of the most derived class (1.8), virtual base classes are initialized in the order they appear on a depth-first left-to-right traversal of the directed acyclic graph of base classes, where “left-to-right” is the order of appearance of the base classes in the derived class base-specifier-list —首先,并且仅对于最派生类(1.8)的构造函数,虚拟基类将按照它们在基类的有向无环图的深度优先的从左到右遍历时出现的顺序进行初始化,其中“左“从右到右”是基类在派生类base-specifiner-list中的出现顺序
... ...
N3126 is not the C++ standard. N3126 不是 C ++标准。
It's a draft for the upcoming C++ standard. 这是即将到来的C ++标准的草案。
But anyway, the info about initialization is in the section about initialization for derived classes. 但是无论如何,有关初始化的信息在有关派生类的初始化的部分中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.