On Friday, 25 September 2020 at 15:21:22 UTC, Steven Schveighoffer wrote:
If the input is not ref, you should not return by ref, because then you would be returning a reference to local stack data that is about to be destroyed.

Yes, I understand that. What I'm really after at this point is that I would like to write a clever mixin that would handle all of these decisions for me. It should generate a function that takes arguments and returns the result by value or const reference depending on what is more appropriate for the given types. I was under the impression that this could be accomplished using in or some other qualifiers.

Reply via email to