Re:Printing 1 to 1000 without loop or conditionals
by Raphael_Amiard on Monday January 03, 2011 @06:33AM
(#2062845)
The loop in the array initialization is generated by the compiler for the static version, by the runtime for the dynamic allocation version. It's still a loop.
You're just re-using a loop already implemented in the runtime. That's quite the same thing as using map, though a tiny bit clever. But if you qualify map as cheat, well then the constructor trick is just a cleverer cheat.
You're just re-using a loop already implemented in the runtime. That's quite the same thing as using map, though a tiny bit clever. But if you qualify map as cheat, well then the constructor trick is just a cleverer cheat.