loop through specific class members

Trass3r mrmocool at gmx.de
Sun Mar 29 15:22:16 PDT 2009


BCS schrieb:
> Hello Sergey,
> 
>> but this doesn't:
>>
>> template Tuple(T...)
>> {
>> alias T Tuple;
>> }
>> void foo()
>> {
>> foreach (a; Tuple!("a", "b", "c"))
>> pragma(msg, a);
>> }
>> $ dmd -c test.d
>> test.d(8): Error: string expected for message, not 'a'
>> test.d(8): Error: string expected for message, not 'a'
>> test.d(8): Error: string expected for message, not 'a'
>> *This* seems like a bug to me.
>>
> 
> try indexing it:
> 
> template Tuple(T...)
> {
> alias T Tuple;
> }
> void foo()
> {
> alias Tuple!("a", "b", "c") Tpl;
> foreach (i,a; Tpl)
>  pragma(msg, Tpl[i]);
> }
> 
> (BTW that is a known bug)
> 

Do you know the bug number?


More information about the Digitalmars-d-learn mailing list