CRTP in D?
Bill Baxter
wbaxter at gmail.com
Thu Aug 20 13:21:34 PDT 2009
On Thu, Aug 20, 2009 at 12:15 PM, div0<div0 at users.sourceforge.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> John C wrote:
>> div0 Wrote:
>>> While we're on the subject, is it possible to mixin in a tuple?
>>> Doesn't seem like you can...
>>>
>>> class C(M...) {
>>> mixin M;
>>> }
>>>
>>> Doesn't work.
>>
>> import std.typetuple;
>>
>> class C(M...) {
>>
>> mixin TypeTuple!(M);
>>
>> }
> Unfortunately that doesn't work.
>
> It stops the immediate compile error, but the mixin doesn't
> do anything:
This doesn't work either:
class C(M) {
mixin M;
}
template Foo() { void blarf() {} }
auto x = new C!(Foo);
x.blarf;
because a parameter that is itself a template needs to be an alias
template argument like so:
class C(alias M) { ... }
As far as I know you can't have an alias variadic argument or pass
template aliases to a regular variadic template arg.
--bb
More information about the Digitalmars-d-learn
mailing list