It might be more obvious to restrict the scope of the vector.  Instantiating a std::vector is nothing compared to the amount of code you have in each loop.