Re: How does Rebindable suppress the compiler's optimizations for immutable?

2019-02-14 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 14 February 2019 at 23:55:18 UTC, SimonN wrote: std.typecons.Rebindable!(immutable A) is implemented as: private union { immutable(A) original; A stripped; } ...@trusted assignment operators... @property inout(immutable(A)) get() @trusted pure

How does Rebindable suppress the compiler's optimizations for immutable?

2019-02-14 Thread SimonN via Digitalmars-d-learn
std.typecons.Rebindable!(immutable A) is implemented as: private union { immutable(A) original; A stripped; } ...@trusted assignment operators... @property inout(immutable(A)) get() @trusted pure nothrow @nogc inout { return original; }

Re: Best practices of using const

2019-02-14 Thread envoid via Digitalmars-d-learn
Thank you for such a comprehensive answer.