mixin string evaluation

Martin Krejcirik mk-junk at i-line.cz
Sun Jul 21 09:26:40 PDT 2013


Is it somehow possible to evaluate a string on template parameters ?
Something like this:

enum source = "TYPE var;";

template Eval(TYPE)
{
	string Eval()
	{
		return evaluate(source);  <-- replace TYPE with int
	}
}

mixin(Eval!int); <-- int var here


Basically I need a string mixin inserted into the template before the
template parameters are evaluated.


-- 
mk


More information about the Digitalmars-d-learn mailing list