Optional parameters referring to previous parameters?
Mehrdad
wfunction at hotmail.com
Thu May 10 07:33:30 PDT 2012
On Thursday, 10 May 2012 at 14:11:32 UTC, Mafi wrote:
> Am 10.05.2012 02:16, schrieb Mehrdad:
>> Is this possible/should it compile?
>>
>> If not, should I make an enhancement request for it? It's been
>> something
>> that would've been useful in a ton of situations for me...
>>
>> void process(R)(R items, size_t maxCount = items.length)
>> {
>> }
>
> Solution:
> void process(R)(R items) {
> process(items, items.length);
> }
>
> void process(R)(R items, int maxCount);
>
> Is such a miminal syntactic sugar addition worth it?
Yes! That's, like, 80 fewer characters... And it doesn't scale
with multiple optional arguments..
More information about the Digitalmars-d
mailing list