given the cited source on Stackoverflow, it seems that if I want to insert into a container while iterating through it, I need to use std::list.
That does not say that "one has to use list". It says which iterators you need to revalidate, if you insert to a container. In case of std::list that list is just shorter.