by sillysaurus3 · 12y ago · 0 comments
In general, #include <algorithm> is a bit worrisome, because it usually indicates someone is trying to be overly clever with C++. On the other hand, if the codebase is written in that style, then the whole codebase should be consistently written in that style. The inconsistency is the worrisome part: either use it everywhere or nowhere.
Anyway, STL is pretty massive, and knowing all of it isn't the same thing as being a C++ expert. Knowing what to avoid is almost as important as knowing what to use.
for (const auto& element : collection) { }
What's wrong with <algorithm>? I use it all the time for sort, swap, and random_shuffle comes up more frequently than I expect.
Unfortunately, the gamedev industry will probably be stuck with pre-C++11 for another decade.
> I forgot that sort was in <algorithm>
Uhm, sillysaurus3, could I see you in my office please.
:-)
If they get a mild panicked look in their eyes and go straight for string, vector, and iostream, my spidey-sense starts tingling.....
EDITed for grammar