Is it possible to "overload" based on visibility?

60rntogo 60rntogo at gmail.com
Fri Sep 25 14:12:08 UTC 2020


On Friday, 25 September 2020 at 13:15:27 UTC, Steven 
Schveighoffer wrote:
> I don't know, you can search for and report it here: 
> https://issues.dlang.org

I find it quite hard to search for anything here, but I couldn't 
find anything similar so I submitted a bug report.

> You can use auto ref to alleviate that:
>
> int x()(auto ref Foo f) // needs to be a template for auto ref 
> to work

That's a good point, thanks. Since we are on that topic, how 
would that differ from the following?

int x(in Foo f)

And going further, if instead of int I wanted to return something 
that might also be expensive to copy, what would be the best way 
to declare the function?


More information about the Digitalmars-d-learn mailing list