Short overview on D
Rikki Cattermole via Digitalmars-d
digitalmars-d at puremagic.com
Sun Aug 3 04:56:26 PDT 2014
On 3/08/2014 11:53 p.m., Bayan Rafeh wrote:
> Small question. Can anyone give me an example of when one would use a
> parametrized block as opposed to a parameterized class or method?
mixin templates take the context for which they are mixed in. Basically:
mixin template FooT() {
void FooT() {
//...
writeln(bar);
}
}
void myfunc() {
string bar;
//...
mixin FooT;
}
Templated classes/structs/unions/method or functions are used for if you
want to modify code gen itself.
More information about the Digitalmars-d
mailing list