C++ Compiler Error C2280 “attempting to reference a deleted function” in Visual Studio 2013 and 2015

后端 未结 7 1023
误落风尘
误落风尘 2020-11-27 18:03

This snippet is compiled without errors in Visual Studio 2013 (Version 12.0.31101.00 Update 4)

class A
{
public:
   A(){}
   A(A &&){}
};

int main(i         


        
7条回答
  •  清歌不尽
    2020-11-27 18:52

    I had the same problem and it was due to a poorly defined member variable:

    double const deltaBase = .001;
    

    Putting this in will cause the copy constructor to be deleted. Get rid of the "const" and assign in the constructor.

提交回复
热议问题