这是我的课
class A {
public:
A(int);
A(A const&) = delete;
A& operator=(const A& a) = delete;
// etc.
};
Run Code Online (Sandbox Code Playgroud)
在另一个文件中,我可以像这样调用构造函数:
auto foo = A(123);
Run Code Online (Sandbox Code Playgroud)
这解决了复制构造函数而不是我期望的构造函数,为什么?
error C2280: 'mynamspace::A::A(const mynamespace::A &)': attempting to reference a deleted function
Run Code Online (Sandbox Code Playgroud)