How to copy object of class A to another object of class B?

zhmt via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 28 23:25:43 PST 2015


On Wednesday, 28 January 2015 at 14:59:52 UTC, Ali Çehreli wrote:
> name must be 'enum':
>
> On 01/28/2015 06:34 AM, zhmt wrote:
>> void getT(SRC,DEST)(SRC src,DEST dest)
>> {
>>     foreach (i, type; typeof(SRC.tupleof)) {
>>         string name = SRC.tupleof[i].stringof;
>
>         enum name = SRC.tupleof[i].stringof;
>
>>         __traits(getMember, dest, name) =  __traits(getMember, 
>> src, name);
>>          writeln(name);
>>     }
>> }
>>
>> when I write the code above, the compile complains that:
>>
>> source/app.d(14): Error: variable name cannot be read at 
>> compile time.
>
> Ali

@Ali, I have test the enum name declaration, it works well, Thx 
for your help.


More information about the Digitalmars-d-learn mailing list