How to iterate through all modules for use with the new getUnitTests trait?

Dicebot public at dicebot.lv
Wed Nov 6 11:56:17 PST 2013


module aaa;

import std.string;

template Alias(alias S)
{
	alias Alias = S;
}

void main()
{
	import std.string;
	
	foreach (symbol_name; __traits(allMembers, aaa))
	{
		alias symbol = Alias!(__traits(getMember, aaa, symbol_name));
		static if (symbol.stringof.startsWith("module "))
		{
		}
		else static if (symbol.stringof.startsWith("package "))
		{
			// recursion
		}
	}
}


More information about the Digitalmars-d-learn mailing list