Boost logo

Boost Users :

From: Scott Meyers (usenet_at_[hidden])
Date: 2006-05-01 19:28:47


Suppose I have an auto_ptr, shared_ptr, or scoped_ptr. If I want to set it to
null, I do this (assuming the pointer is named p):

   p.reset(); // okay

If I try this,

   p = 0; // error

I get an error during compilation. In other words, reset works, but assignment
of the null pointer does not.

But suppose p is an intrusive_ptr. Now

   p.reset(); // error

fails, and

   p = 0; // okay

succeeds. In other words, assignment works, but reset does not. I find this,
er, unintuitive. Does anybody know why intrusive_ptr marches to its own
nullifying drummer?

Thanks,

Scott


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net