Technically, that's a iterator invalidation and those are indeed hard to keep track of. There are runtime libraries that keep track of pointer-invalidation for you however.
In any case, a std::vector<shared_ptr<std::string> > would actually avoid the issue in this particular case.
Use after free... is more about use of raw pointers IMO. I wouldn't describe that code to be a "use after free" at all. In most languages, you are simply not allowed to change the container at all. Iterator invalidation is a hard issue in any language.