Boost logo

Boost Users :

From: Pablo Aguilar (pablo.aguilar_at_[hidden])
Date: 2005-01-05 14:57:11

Thanks for your reply...

You're right, "reset" would delete the pointer... but when you're getting
rid of a pointer obtained from a factory, like I was in my case, pointers
don't always get disposed of using delete, but rather another function (like

And rather than writing special purpose smart pointers for each type of
deleting function (p->dispose(), p->release(), api_function_free(p), etc..)
you can use shared_ptr with a custom deleter (here:
mem_fn(&pointer_type::dispose) or bind(&api_function_free, _1))

"tom gee" <rockonedge_at_[hidden]> wrote in message
> If you intention is to release the pointer, reset(0) can achieve
> this. The document says:
> "void reset(T * p = 0); // never throws
> Deletes the object pointed to by the stored pointer and then stores a
> copy of p ".
> With reset, you should be able assign another pointer.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at