草庐IT

c++ - C2280 : attempting to reference a deleted function (union, 结构体,复制构造函数)

当我尝试在VisualStudio2015中编译以下最小示例时,我遇到了误导性错误消息的问题:classVector{floatx;floaty;public:Vector(floatx,floaty):x(x),y(y){}Vector&operator=(constVector&v){x=v.x;y=v.y;return*this;}//Vector(Vector&&)=default;};classRect{public:union{struct{Vectorp1,p2;};struct{floatp1x,p1y,p2x,p2y;};};Rect():p1(0,0),p2(0,0

c++ - 错误 C2280 : attempting to reference a deleted function (atomic<int>)

我有一个classA带有成员变量_atomicVar类型std::atomic.#includeclassA{public:A();~A();private:std::atomic_atomicVar;};如果我构建项目,我会收到以下错误:errorC2280:'std::atomic::atomic(conststd::atomic&)':attemptingtoreferenceadeletedfunction我主要是一名C#开发人员,所以我还不了解C++的每个细节(还)。我不知道我在哪里使用atomic的复制代码.我还尝试初始化_atomicVar:std::atomic_ato

c++ - 错误 C2280 : 'std::thread::thread(const std::thread &)' : attempting to reference a deleted function

我在尝试创建使用C++11标准线程的VC++静态库时遇到问题。我目前有两个类,我可以在我的起始类(最后声明的)上声明并稍后定义一个线程。在这个阶段,代码只是一个套接字监听器,然后创建另一个类的对象来处理每个接受的客户端。这些子对象应该创建并行数据捕获、编码和传输所需的线程。问题是:如果我在我的其他类上声明了一个std::thread,即使我在我的起始类上所做的完全一样,无论如何,我在构建errorC2280时遇到这个错误:'std::thread::thread(conststd::thread&)':试图引用已删除的函数[...]\vc\include\functional11241

c++ - 错误 C2280 : attempting to reference a deleted function (unique_ptr)

我检查了一些使用原始指针的旧代码,并将它们更改为unique_ptr。现在,当我尝试编译代码时,收到此错误消息:Error1errorC2280:'std::unique_ptr>::unique_ptr(conststd::unique_ptr>&)':attemptingtoreferenceadeletedfunctiond:\visualstudio2013\vc\include\xmemory0关于这种情况的编译器输出很大——为了节省这个问题的空间,请参阅here.据我所知,这与我使用唯一指针的方式有关。它从这里开始(level.h,第65-66行):typedefstd::

c++ - 错误 C2280 : attempting to reference a deleted function

我是游戏开发的新手,也是C++的新手,但我已经开始开发一款打砖block小游戏。我以前让它运行过,但在重构(引入ArkanoidGame类)后它无法编译,我也不知道为什么。我得到的错误是:d:\dropbox\development\gamedev\c++\arkanoid\arkanoid\main.cpp(14):errorC2280:'ArkanoidGame::ArkanoidGame(void)':attemptingtoreferenceadeletedfunctiond:\dropbox\development\gamedev\c++\arkanoid\arkanoid\

Visual Studio 2013 和 2015 中的 C++ 编译器错误 C2280 "attempting to reference a deleted function"

此代码段在VisualStudio2013(版本12.0.31101.00更新4)中编译时没有错误classA{public:A(){}A(A&&){}};intmain(int,char*){Aa;newA(a);return0;}在VisualStudio2015RC(版本14.0.22823.1D14REL)中编译时出现此错误:1>------Buildstarted:Project:foo,Configuration:DebugWin32------1>foo.cpp1>c:\dev\foo\foo.cpp(11):errorC2280:'A::A(constA&)':atte

Visual Studio 2013 和 2015 中的 C++ 编译器错误 C2280 "attempting to reference a deleted function"

此代码段在VisualStudio2013(版本12.0.31101.00更新4)中编译时没有错误classA{public:A(){}A(A&&){}};intmain(int,char*){Aa;newA(a);return0;}在VisualStudio2015RC(版本14.0.22823.1D14REL)中编译时出现此错误:1>------Buildstarted:Project:foo,Configuration:DebugWin32------1>foo.cpp1>c:\dev\foo\foo.cpp(11):errorC2280:'A::A(constA&)':atte