Overloading based on attributes - is it a good idea?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri May 31 18:30:17 UTC 2019


On Friday, 31 May 2019 at 17:52:28 UTC, Manu wrote:
> out params. wrapping return values kinda sucks, inhibits RVO.

It can, yes. It requires more advanced RVO optimizations to avoid 
it.

> overloading on return value seems problematic... how would that 
> work?

The compiler narrows down possible return types until one is 
left. The simple version would require an explicit type, a more 
advanced version would look at how the result is used and use 
that to narrow down the candidate types until one is left.






More information about the Digitalmars-d mailing list