anyway to set a const object after the fact?

aliak something at something.com
Tue Oct 30 11:24:43 UTC 2018


On Monday, 29 October 2018 at 22:12:24 UTC, Paul Backus wrote:
> Use a lambda:
>
> const string[] restArgs = () {
>   foreach(i, arg; args) {
>     if (isValidArg(arg)) {
>       return args[i+1 .. $];
>     }
>     others ~= arg;
>   }
> }();

That works.


More information about the Digitalmars-d-learn mailing list