On Friday, 27 October 2017 at 07:36:45 UTC, Jacob Carlborg wrote:
On 2017-10-26 12:42, Kagamin wrote:
You mean non-member functions are preferred? I encountered
this more from performance point: especially in case of small
structures like Point it would be more beneficial to pass them
by value than by reference, which can be achieved by extension
methods, but then you need to import the respective module to
have those extension methods available.
Adding methods to a struct will not increase its size.
Instance methods require this be passed by reference, which
requires storage fiddling on the caller side. It's likely to
disappear after inlining, but still.