I am not really sure what is going on here. Is the ofstream created more than once?
It's moved. As from the reference:
4) Move constructor. First, move-constructs the base class from other (which does not affect the rdbuf() pointer), then move-constructs the std::basic_filebuf member, then calls this->set_rdbuf() to install the new basic_filebuf as the rdbuf() pointer in the base class.
It is created only once and then it is just re-opened?
See 1st point.
Would you qdvice me to add in every destructor the oFile.close() function?
That's already done in the std::ofstream
destructor automatically
Shall I pass as parameter just the vector and use the ofstream just in the bar() function?
Can't tell what the above answers have as consequences for your use case.