Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2000-03-13 11:15:27


> When I have a pointer in a class, I often want the const methods of
> the class to pass the constness through to the pointed-to members.
> I realize that this is NOT the behavior of a naked pointer.

I see. This seems like good behavior for pointers that express ownership
like scoped_ptr, shared_ptr and CopyPtr/ClonePtr/deep_ptr.

> An alternate solution, would be to make all of the original six
> classes be Qualified, and make the user explicitly say "mutable" if
> they don't want the constness passed through.

I for one would support changing scoped_ptr and shared_ptr to this model,
even though it makes them less like raw pointers. All you lose is the
ability to declare a non-reseatable pointer to a modifiable object. (Note
that mutable doesn't give you that back.)

    -- Darin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk