问题描述
我在Xcode 4.2中编写一个C ++库
我的一个类不会编译这个错误:试图使用一个删除的函数。 p>
没有具体的说明它在说什么功能。
我不想在这里发布类代码,但任何人都有任何想法这个错误的意思? 在 上找不到:
感谢一堆
$ b $ <$ p <$ p> $ b
struct Foo {
pre>
Foo(const Foo&)= delete;
};
尝试使用这样的函数是一个错误,这样做的目的是,在这个例子中,这种类型的拷贝构造是不可能的,这是一个更直接的替代非可复制的技巧使用pre-C ++ 11。
此外,在C ++规范中有规则导致成员函数隐式删除。
错误告诉你,你的程序试图使用一个已删除的函数,你必须发布你的错误,得到更详细的帮助。 p>
I am writing a C++ library in Xcode 4.2
One of my classes won't compile with this error : "attempt to use a deleted function".
There is no specific indication what function it's talking about. I don't want to post the class code here, but does anybody have any idea what this error means? It's nowhere to be found on Google... :(
thanks a bunch
Roey
解决方案In C++11 you can declare functions as deleted:
struct Foo { Foo(const Foo &) = delete; };
Attempting to use such a function is an error. The purpose of doing this is so that, in this example, copy construction of this type is not possible. This is a more direct replacement for the non-copyable trick used pre-C++11.
Also, there are rules in the C++ spec that lead to member functions being implicitly deleted.
The error is telling you that your program attempts to use a deleted function. You'll have to post the error you're getting for more detailed help.
这篇关于xcode-“尝试使用已删除的功能” - 这意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!