Extending bitfields to enumerations of any enumerator type
Timon Gehr
timon.gehr at gmx.ch
Fri Oct 10 16:45:02 UTC 2025
On 10/8/25 23:39, Timon Gehr wrote:
>
> Not applicable to strings, but arithmetic operators don't promote to the
> base type:
Here's an operation that works on string enums:
```d
import std;
enum Field: string{ none=[], dot="." }
void main(){
Field f=Field.dot;
f~=f;
writeln(f);
}
```
(Had only tried `~` before, but you can even do `f~="arbitrary string";`)
More information about the Digitalmars-d
mailing list