Behaviour of const KSharedPtrs
Richard Smith
kde at metafoo.co.uk
Sat Nov 13 00:48:46 GMT 2004
On Saturday 13 November 2004 00:04, Stefan Teleman wrote:
> On Friday 12 November 2004 18:45, Richard Smith wrote:
> > Now, is this a bug? I think so. KSharedPtr<T> is, after all,
> > supposed to to have pointer-like semantics. Pointers don't behave
> > this way. boost::shared_ptr doesn't behave this way. And if I
> > really want this behaviour I can use a KSharedPtr<const T> instead.
>
> This is the const-correct behavior.
Not for a smart pointer, it's not. The thing const-correctness covers for a
pointer (or by extension a smart pointer) is not allowing changes to the
value of the pointer (ie, disallowing assignment). You're getting
const-correctness of the pointer confused with const-correctness of the
pointee.
--
Thanks,
Richard
More information about the kde-core-devel
mailing list