On Mon, 31 Oct 2011 07:58:11 -0500, Andrei Alexandrescu wrote:
> On 10/31/11 4:43 AM, Steve Teale wrote:
>> Is there a way to do this. For example if I have
>>
>> struct A { int a, b, c; }
>> struct B
>> {
>> int p, q, r, s;
>> this(A a) { p = a.a; q = a.b; r = a.c; }
>> }
>>
>> A a;
>> B b;
>> b = a;
>
> Use opAssign?
>
Joseph (aka Andrei),
But if B is not mine to mess with?
The two structs have a common type prefix. and D guarantees that there
are predictable values for the remainder of the larger one, so the
compiler could presumably figure it out. (Easy for me to say)
Steve