Type inference and overloaded functions
Namespace
rswhite4 at googlemail.com
Tue Dec 17 17:44:45 PST 2013
On Tuesday, 17 December 2013 at 17:01:55 UTC, bearophile wrote:
> Namespace:
>
>> Done:
>> https://github.com/D-Programming-Language/dmd/pull/2958
>
> If you have a situation like this:
>
> int[3] foo() {
> typeof(return) a;
> return a;
> }
> void main() {
> int[100] b;
> b[0 .. 3] = foo();
> }
>
>
> Can you use code like this to infer the length of the part
> needed to copy?
>
>
> int[3] foo() {
> typeof(return) a;
> return a;
> }
> void main() {
> int[100] b;
> b[0 .. $] = foo();
> }
>
>
> Bye,
> bearophile
No, not currently. But it is an interesting idea. Maybe I will
implement this. And as far as I have enough time, I will also add
test cases. Maybe on christmas. :)
More information about the Digitalmars-d-learn
mailing list