[英]How do I know where “C2280 - attempting to reference a deleted function” occurs?
我很难弄清楚代码中的哪一部分会导致标题中提到的错误。 错误列表中的错误消息是这样的:
error C2280: 'Foo::Foo(const Foo &)' : attempting to reference a deleted function
file: vector, line: 1100
编译器输出如下所示:
d:\visual studio 2013\vc\include\vector(1100): error C2280: 'Foo::Foo(const Foo &)'
: attempting to reference a deleted function
e:\testproject\src\foo.h(22) : see declaration of 'Foo::Foo'
this diagnostic occurred in the compiler generated function
'luabridge::luabridge::TypeListValues<luabridge::TypeList<P1,luabridge::None>>
::TypeListValues(const luabridge::TypeListValues<luabridge::TypeList<P1,luabridge::None>> &)'
with
[
P1=Foo &
]
对我来说,此错误消息完全没有说明错误发生的位置。 我知道这是关于删除的副本构造函数(foo.h中的第22行是删除的副本ctor),仅此而已。 我也想删除复制构造函数。
如何找出错误的确切原因?
没有看到更多的代码很难精确,但是也许您需要使用指向对象的引用计数指针,而不是对象本身。 例如,请参阅此帖子 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.