Compare boost::hana to D
Adrian Matoga via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 21 12:50:10 PDT 2017
On Friday, 21 April 2017 at 13:10:43 UTC, Adam D. Ruppe wrote:
> On Wednesday, 19 April 2017 at 18:02:46 UTC, Adrian Matoga
> wrote:
>> [2] https://epi.github.io/2017/03/18/less_fun.html
>
> BTW in your D foreach, you could also have done `switch`
>
> void trigger(string event) {
> switch(event) {
> foreach (i, e; events) {
> case e:
> foreach (c; callbacks_[i])
> c();
> return;
> }
> default:
> assert(false, "trying to trigger an unknown event: "
> ~ event);
> }
> }
>
>
> And the compiler+runtime can optimize that into a binary search
> when it gets larger automatically.
Thanks, I completely forgot about it. I should update the article
soon.
More information about the Digitalmars-d
mailing list