g++ C++11 链式施工合规性
我只是想知道 g++ 是否实际上符合链式构造函数(或任何名称)的 C++11 标准。
示例:
class MyClass
{
MyClass(int x, int y = 0);
MyClass(int y = 0) : MyClass(8, y) {}
};
即使我包含了 -std=c++0x (或 -std=gnu++0x)参数(没有 -std=c++11),我仍然收到此错误
错误:类型“MyClass”不是“MyClass”的直接基
我不想跳到结论,我浏览了网络,但似乎找不到任何有关它的信息。
顺便说一句,我正在使用 g++ (Debian 4.6.2-4) 4.6.2
I was just wondering if g++ actually complies with the C++11 standard of chained constructors (or whatever it's called).
example:
class MyClass
{
MyClass(int x, int y = 0);
MyClass(int y = 0) : MyClass(8, y) {}
};
I keep getting this error even though I've included the -std=c++0x (or -std=gnu++0x) parameter (there is no -std=c++11)
error: type ‘MyClass’ is not a direct base of ‘MyClass’
I don't want to jump to conclusions and I've looked around the net but can't seem to find any information about it.
By the way, I'm using g++ (Debian 4.6.2-4) 4.6.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它尚不支持(寻找委托构造函数)。
除此之外,你不觉得你的设计非常模糊吗?
MyClass(1)
应该调用什么?It's not yet supported (look for delegating constructors).
Other than that, don't you think your design is highly ambiguous? What should
MyClass(1)
call?