Extend D's switch statement?

Idan Arye via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 8 04:11:02 PDT 2015


On Wednesday, 8 July 2015 at 09:57:16 UTC, ketmar wrote:
> On Wed, 08 Jul 2015 07:15:25 +0000, Yuxuan Shui wrote:
>
>> I think it will be useful to extent switch statement to 
>> support any type that implements opEquals and opHash.
>> 
>> Is there any technical difficulties to implement this?
>
> no, you can do that* with some template programming. so there 
> is no reason to increase compiler complexity.
>
> * with some limitations, but they aren't that big.

http://dlang.org/phobos/std_algorithm_comparison.html#.predSwitch


More information about the Digitalmars-d mailing list