anyway to set a const object after the fact?

Laurent Tréguier laurent.treguier.sink at gmail.com
Tue Oct 30 14:24:26 UTC 2018


On Tuesday, 30 October 2018 at 11:23:48 UTC, aliak wrote:
> Guess I could do that. But would there be a difference if I 
> just declared the restArgs as non const then? Given the 
> objective is "set this var to point to this thing and not allow 
> it to be set to point to anything else".

The difference with const is that you wouldn't be able to modify 
the array itself (by adding or removing arguments for example). 
But yes, you can still re-assign it multiple times using 
Rebindable, so the lambda solution is a better idea indeed.


More information about the Digitalmars-d-learn mailing list