How to realize copyable/postblit class
SimonN via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jun 13 13:59:42 PDT 2015
On Saturday, 13 June 2015 at 08:52:59 UTC, John Colvin wrote:
> perhaps:
>
> class A
> {
> struct S
> {
> // ...
> }
> S s;
> alias s this;
> this(A rhs)
> {
> s = rhs.s;
> }
> }
I'm using this now, and it doesn't feel like a workaround too
much.
For something with 5 value fields, it's already shorter than the
original solution.
Thanks! :-)
-- Simon
More information about the Digitalmars-d-learn
mailing list