What’s the rationale for the push_back method name in C++ std::vector? For instance, is there a stack-based origin (push being a common stack operation)? Was there a pre-existing library that used these terms for adding to a sequence?
Besides common terms other APIs use like append and add, insert_end would seem to be more internally self-consistent (though front and back do exist elsewhere).
As you mention,
pushandpopare common names for stack operations. The reason it’s not justpushandpopis so that it can be consistent with the other containers.std::vectoronly implementspush_backandpop_back, but there is alsopush_frontandpop_frontin, for example,std::list. Having consistent names is useful when writing generic functions.