what is the difference between template and mixin template
Artur Skawina
art.08.09 at gmail.com
Sun Jun 10 10:24:51 PDT 2012
On 06/10/12 19:08, Zhenya wrote:
> 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
Because the compiler does not disallow it, obviously.
Do you think that it should? If yes - why?
> writeln(.x);
> writeln(x);
> readln();
> }
>
artur
More information about the Digitalmars-d-learn
mailing list