|
Boost : |
From: Philippe Mori (philippe_mori_at_[hidden])
Date: 2005-08-16 18:35:56
>
> I've developed a clone_ptr class that performs a clone of an abstract
> pointer without the need
> for a clone method.
>
How can you correctly do a clone when an interface does not have a clone
method and you don't know the concrete type ?
Also, what do you provide for class that have a clone method that is named
differently (Clone is another often used function name at least in Active X
(COM) programming)
> See following link for more info:
> http://code.axter.com/clone_ptr_introduction.htm
>
Well, some functions are not exception safe or does not follows accepted
rules like the one in (More) Exceptional C++ books. In particular, it is
generally not safe to destroy an object and construct another one. What will
happen if the object cannot be constructed and the original object is
already destroyed. Will you have a clone_ptr that reference an invalid
object.
Philippe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk