[Issue 14931] switch doesn't work with any pointers

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 18 23:51:37 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14931

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #9 from Walter Bright <bugzilla at digitalmars.com> ---
The only thing you can do is have two tables. The first is a table of pointer
values, upon which a binary search is done to convert the switch expression
into an integer. Then use the integer to index into the second table of jump
addresses.

Of course, you can do this manually in conventional D anyway, and get just as
good results.

--


More information about the Digitalmars-d-bugs mailing list