Static Foreach
BCS
BCS at pathlink.com
Tue Sep 19 11:26:16 PDT 2006
nazo wrote:
> I have some suggestions.
> How about support to "static foreach" as "static if"?
> Problem is that it is not still able to use array in template arguments.
why limit it to arrays, or for that matter, why like types?
(I have suggested this before
http://www.digitalmars.com/d/archives/digitalmars/D/32232.html)
struct Fig
{
char c;
int i;
real r;
void Display()
{
witheach(memb; this)
writef(memb, " ");
}
bool opCmp(Fig other)
{
witheach(alias o, memb; this)
if(other.o != memb) return false;
return true;
}
}
More information about the Digitalmars-d
mailing list