dynamic classes and duck typing
Pelle Månsson
pelle.mansson at gmail.com
Mon Nov 30 14:13:23 PST 2009
Walter Bright wrote:
> Bill Baxter wrote:
>> On Mon, Nov 30, 2009 at 1:00 PM, Walter Bright
>>> void opDispatch(string name, T...)(T values...)
>>> ^^^
>>
>> You didn't use to have to do that with variadic templates. Is that
>> also a new change in SVN?
>
> I believe it was always like that.
>
What do you mean? Not the D I played with?
void test1(T...)(T ts) {
writeln(ts); //works as expected
}
void test2(string s, T...)(T ts) {
writeln(s); // requires manual specifying of each type
writeln(ts); // e.g. test2!("foo", int, int)(1,2)
}
void test3(string s, T...)(T ts...) {
writeln(s); // silently dies when called with
writeln(ts); // test3!("foo")(1,2,3,4) in v2.034
}
More information about the Digitalmars-d
mailing list