开发者

intrusive_ptr => _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

开发者 https://www.devze.com 2023-03-06 22:31 出处:网络
I use boost \'intrusive_ptr\' in my code but when I delete some objects I got a crash ! In fact I use the same \'intrusive_ptr\' into a class and return it, like this :

I use boost 'intrusive_ptr' in my code but when I delete some objects I got a crash !

In fact I use the same 'intrusive_ptr' into a class and return it, like this :

typedef intrusive_ptr<Node> ref;

class MyContainer
{
ref SmartPointer;
};

class Compiler
{
private:
ref MyNode;

public:
ref getMyNode() { return MyNode; }
    ref process() {MyNode.Reset(); ... return MyNode; }
};

MyContainer * c1 = new MyContainer();
c1->SmartPointer = compiler.process();

delete c1;开发者_如何学编程 <= CRASH
0

精彩评论

暂无评论...
验证码 换一张
取 消