static foreach

John S. Skogtvedt jss2k2 at chello.no
Wed Nov 15 02:05:02 PST 2006


A kind of "static foreach" already works for tuples,
why not other constants as well?

Example:

import std.typetuple;

void main() {
	alias TypeTuple!(void, void, void) TL;
	foreach (t; TL) {
		pragma(msg, "this prints three times");
	}

	const char[] s = "abc";

	foreach (c; s) {
		pragma(msg, "and maybe this should as well?");
	}
}



More information about the Digitalmars-d mailing list