I have read discouraging statements about using plain arrays in c++. Where videogame development is involved we are aiming, as far as I know, at max speed execution. STL containers (such as std::vector) bring some elements not present in plain old arrays (iterators, etc). Does such functionality add overhead? (e.g. pointer chasing, etc) If so, is it worth it in real life to lose some speed in exchange for type safety?
This depends on what operation you are performing on vectors. vectors are actually really fast. iteration is as fast as possible, since the vector does not store pointers but an array of objects in one straight block of memory, so iterating over a vertex is as fast as iterating over an array. And even the iterator-objects do not add a overhead, in production-mode (so if you don't compile in debug-mode), they do no runtime-checks but just trust you in what you're doing. Adding a new element is still really fast as long as it still fits in the allocated block of memory. If not, it either copies or moves the objects to a new block of memory, depending on if this class has a move-constructor and if it is noexcept. You can, of course, std::move your object in or even emplace_back (construct it right in place) so you don't even need to copy or with emplace_back not even to move. I'd never use plain arrays, they just need too much attention to not leak and not read from uninitialized memory, vectors will do all this for you. In debug-mode, vectors will perform boundary-checks when you access an element (i.e. with array-operator ), in non-debug mode they won't to give you best performance. vectors are awesome, just use them!