3 ms·
> to another a map is a better choice. Are you thinking more of JS or another functional scripting language than C/C++? C doesn’t have map, so it’s not an opti
by dahart 7y ago
> to another a map is a better choice.
Are you thinking more of JS or another functional scripting language than C/C++? C doesn’t have map, so it’s not an option, and in C++ it’s called something else.
In JS, I so wish that I could switch to functional constructs like map permanently, but map and foreach are much slower than loops, an order of magnitude or more for tight loops. I’m still forced to use loops in performance critical code, even if I consider map a better choice.
Coming back to C++ after having been in JS land for 5 years, C++ feels constantly difficult to use, and all the names for the functional primitives don’t seem to make intuitive sense like they do in JS.
- Gene_Parmesan 7y ago> order of magnitude or more for tight loops I just learned this about JS's map/foreach a few weeks ago. I didn't think it was possible to be more disappointed by JS than I already was, but somehow I managed it.