Template Tuple Defaults
Peter Neubauer
peterneubauer2 at gmail.com
Sun Mar 30 16:29:10 PDT 2008
Simen Kjaeraas schrieb:
> On Sun, 30 Mar 2008 06:06:00 +0200, Peter Neubauer
> <peterneubauer2 at gmail.com> wrote:
>
>> Is there a way to give default types to template tuple parameters?
>> Like this:
>>
>>
>> class Test (TTuple ... = [char, int] )
>> {
>> // ...
>> }
>>
>> void main ()
>> {
>> Test t; // Equivalent to Test !(char, int) t;
>> }
>>
>>
>> Obviously, that does not compile.
>>
>> Thanks in advance,
>> -Peter
>
> This oughtta work (does on my confuser).
>
>
> import std.typetuple;
>
> class Test (TTuple ... = TypeTuple!(char, int) )
> {
> // ...
> }
>
> void main ()
> {
> Test t; // Equivalent to Test !(char, int) t;
> }
>
>
> -- Simen
Strange, all I get is this:
test.d(3): found '=' when expecting ')'
test.d(3): { } expected following aggregate declaration
test.d(3): no identifier for declarator TypeTuple!(char,int)
test.d(3): semicolon expected, not ')'
test.d(3): Declaration expected, not ')'
Maybe this is a difference between D 1.0 and 2.0? (I'm using 1.0)
-Peter
More information about the Digitalmars-d-learn
mailing list