Taking a copy of an object

Derek Parnell derek at nomail.afraid.org
Wed Aug 9 23:36:04 PDT 2006


On Thu, 10 Aug 2006 00:30:15 -0400, Mikola Lysenko wrote:

> Adding a virtual deep copy method to Object is a bad idea.

...

> A different solution is to require each type to explicitly state if it 
> supports deep-copies at compile time.
...
 
> If everyone adheres to this convention, the following templates to allow
> anyone to test if a type is clonable at compile time - and easily perform
> a clone.  

...

> For completeness, there is also a shallow copy or 'dup'
> operation using the same technique.

Yes. This is most of what I was trying to get across. 

The only problem is the phrase "If everyone adheres to this convention".
That will never happen, people being as they are. This is why I'd like
these capabilities to be supported by the compiler via the use of operators
that invoke the associated 'op' function.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
10/08/2006 4:31:55 PM



More information about the Digitalmars-d mailing list