Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2007-10-09 17:50:35


Simonson, Lucanus J wrote:
> Steven wrote:
>> Suppose that I want to write
>> template<class Rectangle, class T>
>> void move_up(Rectangle&, T offset);
>> to modify a rectangle in place.
>> if I need to copy the rectangle this isn't
>> going to work.
>
> You don't need to copy the rectangle. It does work. Inheritance and
> composition are just syntactical ways that I can view your data as a
> rectangle of my type in place. The whole point of my design pattern
> is
> that you don't need to copy the rectangle. mimic doesn't copy, it
> returns a reference to your object of the subclass type with a (safe)
> reinterpret_cast.
>
Pendantically speaking, there is no such thing as a "safe reinterpret_cast".
While this is somewhat permmited in production code where the typical
deadline is yesterday, here in boost you need a definite need for using
that.

Anyway, can you explain in some detail how doesn't your adaptation pattern
avoid copying?

Best

-- 
Fernando Cacciola
SciSoft
http://fcacciola.50webs.com

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