replace switch for mapping

EntangledQuanta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 4 13:54:27 PDT 2017


On Monday, 4 September 2017 at 09:23:24 UTC, Andrea Fontana wrote:
> On Thursday, 31 August 2017 at 23:17:52 UTC, EntangledQuanta 
> wrote:
>> Generally one has to use a switch to map dynamic components. 
>> Given a set X and Y one can form a switch to map X to Y:
>>
>> [...]
>
> Does this work for you?
> https://dpaste.dzfl.pl/e2669b595539
>
> Andrea

No, do you realize you are passing those enums at compile time? 
It won't work if they are "runtime" variables, which is the whole 
point of doing all this. You've essentially make a simple problem 
complicated. Why not just overload foo properly?




More information about the Digitalmars-d-learn mailing list