mixin on identifier

Johannes Totz johannes at jo-t.de
Mon Nov 21 15:38:06 PST 2011


Hi!

I'm trying to do:

mixin template StateOne()
{
	int	value;
}

class StateSet(T)
{
	mixin T;
}

int main(string[] argv)
{
	StateSet!StateOne	s = new StateSet!StateOne();

	return 0;
}

Compiler complains with:
main.d(18): Error: template instance StateSet!(StateOne) 
StateSet!(StateOne) does not match template declaration StateSet(T)
main.d(18): Error: StateSet!(StateOne) is used as a type

I think I understand why. And from what I figured I'd need string 
mixins? But I can't figure out how...
Any hints?



Johannes


More information about the Digitalmars-d-learn mailing list