On Sunday, 21 October 2012 at 22:47:00 UTC, Jonathan M Davis wrote:

http://dlang.org/function.html#function-overloading

The big thing to remember here is that constness matters more than refness when overloads are chosen, so if you want refness to matter when choosing an overload, then the constness of the overloads must match, and if there's ever a question between const and non-const, it's the constness of the argument being passed in which wins (e.g. if you have ref T and const ref T, then which one gets called depends on whether the argument is const or not).

There any word on if this was going to change? I'm meaning towards structs/classes with const preference vs non-const preferences. I recall a while back while trying to make copy/move functions and I had to completely duplicate the functions so it would use the right versions.

Reply via email to