On 01/21/2011 04:02 AM, Andrei Alexandrescu wrote:
That being said, it's not difficult to define a generic function that
copies fields over from one class object to another. Here's a start:
import std.stdio;
void copyMembers(A)(A src, A tgt) if (is(A == class)) {
foreach (e; __traits(allMe
spir:
> How many programmers in the world consider this kind of code "not
> difficult"?
(True complex code is when you have to maintain or improve ocean-wide programs
:-) )
That kind of code is library-level one, so it's more difficult than normal user
code.
Bye,
bearophile
On 01/21/2011 02:02 PM, spir wrote:
On 01/21/2011 04:02 AM, Andrei Alexandrescu wrote:
That being said, it's not difficult to define a generic function that
copies fields over from one class object to another. Here's a start:
import std.stdio;
void copyMembers(A)(A src, A tgt) if (is(A == clas