Getting usages of template

Carlin St Pierre via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 17 01:40:45 PST 2016


Is it possible to get the list of usages of a template during 
compile time?

For example:

class Foo
{
	void bar(T)(T t)
	{

	}
}

void main()
{
	Foo foo = new Foo;
	foo.bar(1); // int
	foo.bar(2f); // float
	foo.bar("3"); // string
}

// pragma(msg, TemplateThatGetsTemplateUsages!(Foo.bar)) would 
print:
// (int, float, string)


More information about the Digitalmars-d-learn mailing list