Is it possible to "overload" based on visibility?

60rntogo 60rntogo at
Fri Sep 25 17:58:08 UTC 2020

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.

More information about the Digitalmars-d-learn mailing list