Compare boost::hana to D
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 21 06:10:43 PDT 2017
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.
More information about the Digitalmars-d
mailing list