function default arguments depending on other arguments

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 20 05:01:26 PDT 2014


Tove:

> IIRC:
> Walter's stance was that he needs compelling examples, which 
> proves the utility of this new feature.

Recently I have had a desire for that feature, to write a 
function like this:

int[][] generateTable(in uint nx, in uint ny=nx) {...}

If you give just one argument to this function, it generates a 
square table, otherwise it uses both the given sizes.

Bye,
bearophile


More information about the Digitalmars-d mailing list