【发布时间】:2012-06-19 09:55:35
【问题描述】:
struct Foo {
int data;
Foo() = default;
Foo(const Foo& arg) = default;
};
但是我的编译器doesn't have defaulted constructors yet。
我可以定义像DEFAULTED 这样的宏来代替= default 吗?如果它只是离开该行
Foo(const Foo& arg);
编译器仍会生成其默认值,还是会抱怨?
【问题讨论】:
-
这似乎很困难,因为“= default”东西的行为改变了想要的函数(默认/复制构造函数)的函数。
标签: c++ constructor c++11 c++03