Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-01-21 09:58:12


Jonathan Turkanis <technews_at_[hidden]> wrote:
> "Bronek Kozicki" <brok_at_[hidden]> wrote in message:
>
>> (being quite useless) it's still valid. Please note that deleter
>> will always receive static-type == dynamic-type, when used properly
>> (ie. smart pointer intialized directly with raw pointer).
>
> I still don't agree with this. Can you explain why the following is an
> improper use?
>
> // Library function; returns a pointer to a newly allocated
derived class.
> shape* create_shape(const std::string& description);
>
> // User code:
> mov_ptr<Shape> p(create_shape("fuzzy dog"));

mov_ptr is not directly initialized from raw pointer. Indirection comes
from passing pointer somewhere inside create_shape function. I should
probably add "directly from new expression" and now it should be clear.

B.


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