Pass enum variable as const ref arg

Bastiaan Veelo Bastiaan at Veelo.net
Fri Dec 4 20:45:42 UTC 2020


On Friday, 4 December 2020 at 12:54:25 UTC, Andrey wrote:
> Hello,
>
>> void test(const ref string[3] qazzz) { qazzz.writeln; }
>> 
>> void main()
>> {
>>     enum string[3] value = ["qwer", "ggg", "v"];
>>     test(value);
>> }
>
> Gives errors:

It works if you pass `-preview=rvaluerefparam` to the compiler.

But the other suggestions are better IMO.

—Bastiaan.


More information about the Digitalmars-d-learn mailing list