Pattern matching via switch?

Paolo Invernizzi paolo.invernizzi at gmail.com
Tue Mar 17 08:18:37 UTC 2020


On Sunday, 15 March 2020 at 18:52:01 UTC, Steven Schveighoffer 
wrote:

> D doesn't support this natively. The closest you can get is 
> something akin to what aliak wrote (you would need to write 
> something, not sure if Phobos or some package has implemented 
> the feature), or use cascaded if statements:

I've just given a fast look at the thread, so maybe I'm wrong, 
but this [1] should be ok for pattern matching using plain and 
simple Phobos ...

[1] https://dlang.org/phobos/std_variant.html#.visit




More information about the Digitalmars-d-learn mailing list