Purity, @safety, etc., in generic code

Jakob Ovrum jakobovrum at gmail.com
Wed Feb 20 00:25:44 PST 2013


On Wednesday, 20 February 2013 at 06:00:02 UTC, deadalnix wrote:
> As discussed previously, I really wonder hy a const and non 
> const version of a function can exists in a first place. What 
> problem does it solve that isn't better solved by inout ?

I use overloading of const/immutable in one of my projects to 
avoid a string copy when possible:

https://github.com/JakobOvrum/Dirk/blob/master/irc/client.d#L332

Granted, here const does not apply to the implicit `this` 
parameter, but it is essentially the same thing.


More information about the Digitalmars-d mailing list