I test shared_ptr and lambda deleter as follow code. It's work fine. but when debug it, showing:
RTTI symbol not found for class 'std::_Sp_counted_deleter<cls*, main::{lambda(cls*)#1}, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>'
any problem with my code?
code:
#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;
}
Aucun commentaire:
Enregistrer un commentaire