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?

Reply via email to