On Saturday, 6 February 2016 at 06:39:27 UTC, Marco Leise wrote:
using the template multiple times with the same arguments will
always give you the first instance.
Hmm, consider that the argument was a particular line of code
though, and that's not likely to repeat. I didn't test what would
h
Mixin templates is the way to go if you want something new on
every use of the template. Otherwise using the template
multiple times with the same arguments will always give you
the first instance.
--
Marco
On Friday, 5 February 2016 at 07:44:29 UTC, Rikki Cattermole
wrote:
That code is completely wrong anyway.
Well, obviously it's wrong. If I don't know correct code that
will do what I want, then I can't tell you what I want using
correct code.
But you could do:
alias Derp = TFoo;
Derp obj;
I'm guessing I have to use a "mixin" mixin for this, but...
there's no way to do something like this is there?
template TFoo(T) {
struct T {
int a;
int b;
}
T obj;
}
TFoo!Derp;
Derp bar;
Neither templates, nor mixin templates seem capable of this. Easy
enough to use mixin, with tokenize
On 05/02/16 8:41 PM, cy wrote:
I'm guessing I have to use a "mixin" mixin for this, but... there's no
way to do something like this is there?
template TFoo(T) {
struct T {
int a;
int b;
}
T obj;
}
TFoo!Derp;
Derp bar;
Neither templates, nor mixin templates seem capable of this. Easy en