Don't allow to reassign, but content is editable

Adam D. Ruppe destructionator at gmail.com
Wed Apr 7 12:48:53 UTC 2021


On Wednesday, 7 April 2021 at 12:28:25 UTC, tcak wrote:
>     @property auto b(){ return a.ptr; }  // this is a 
> possibility, but results with overhead of calling. Also, b is 
> not an array anymore, just int*.

Why are you returning a.ptr instead of just a?

If you return just a, it works fine for what you want.


You can virtually guarantee no calling overhead by simply making 
that `final`; then it is easy for the compiler to inline in all 
cases.


More information about the Digitalmars-d-learn mailing list