what is the difference between template and mixin template

Zhenya zheny at list.ru
Sun Jun 10 10:08:45 PDT 2012


Hi!Today I completly understood,what I don't now what is the 
difference between template and mixin template,becouse I think 
that this should'nt work.But compiler is disagree.Could anybody 
explain me please?

import std.stdio;

int x;
template smth()
{
	void smth(){x = 1;}
}

void main()
{
	int x;
	mixin smth;//why it compiles? smth is a regular template
	smth();
	writeln(.x);
	writeln(x);
	readln();
}


More information about the Digitalmars-d-learn mailing list