On 06/06/2016 11:25 PM, Alex Parrill wrote:
You might be able to get away with casting the const away, if you are
sure it won't modify the hash or equality check.

Casting away const and then mutating has undefined behavior. The compiler is free to assume that it doesn't happen.

Be aware that you're working outside of the specified language if you do it. You rely on the compiler producing code that works in your favor when it has no obligation to do so.

I don't think we should ever suggest relying on undefined behavior here in D.learn.

Reply via email to