[英]Does declaring a constructor '= default' in a header file break the ODR
If I define the destructor (or any autogenerated constructor) as default like this:如果我将析构函数(或任何自动生成的构造函数)定义为默认值,如下所示:
struct A {
~A() = default;
};
And then include this in several translation units, does this break the ODR?然后将其包含在几个翻译单元中,这会破坏 ODR 吗? Can someone walk me through the steps at on the ODR page?
有人可以引导我完成ODR页面上的步骤吗? Because i am struggling to understand if the compiler generated destructor will be inline or some other effect to prevent it from breaking the ODR.
因为我很难理解编译器生成的析构函数是否会内联或其他一些效果以防止它破坏 ODR。
No ODR violation.没有违反 ODR。 Member functions are implicitly inline if they are defined inside the class body.
如果成员函数在 class 主体内定义,则它们是隐式内联的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.