2
我測試shared_ptr和lambda deleter作爲下面的代碼。 它工作正常。但是在調試時,顯示:QT show「RTTI symbol not found for class」but work fine
RTTI symbol not found for class 'std::_Sp_counted_deleter<cls*, main::{lambda(cls*)#1}, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
我的代碼有什麼問題嗎?
代碼:
#include <iostream>
#include <memory>
using namespace std;
class cls{
public:
void test(){
cout << "ok\n";
}
virtual ~cls(){
cout << "~cls()\n";
}
};
typedef shared_ptr<cls> stptr;
int main(){
auto del = [](cls* p){delete(p);};
stptr p = stptr(new cls, del);
p->test();
return 0;
}