myClass.add(something)(otherthings)(thisToo);
Denis Koroskin
2korden at gmail.com
Tue Dec 9 18:16:49 PST 2008
On Wed, 10 Dec 2008 03:24:48 +0300, Jarrett Billingsley <jarrett.billingsley at gmail.com> wrote:
> On Tue, Dec 9, 2008 at 7:00 PM, BCS <ao at pathlink.com> wrote:
>> class C
>> {
>> final void add(T...)(T t)
>> {
>> foreach(int i,_;T)
>> _add(t[i]);
>> }
>> //.....
>> }
>>
>>
>> (new C).add(something, otherthings, thisToo);
>
> If all the params are the same type, typesafe variadics are a more
> efficient/less code-bloaty way to do it.
>
> void add(int[] things...)
> {
> foreach(thing; things)
> _add(thing);
> }
*And* allows overriding them!
More information about the Digitalmars-d-learn
mailing list