Hey Im getting an error I think has to do with copying ofstream variable from reading other posts and Ive tried to change
std::ofstream outfil;
void PrintValues(const std::string& title, std::vector
takes a std::ofstream
by value, that is, copying the actual argument you pass to it, but fstreams may not be copied, hence the error you get regarding the private base it has.
You got it right when you thought of references as a solution, but you missed the point where you should use it. The correct way to solve your problem is to take a std::ofstream
by reference in PrintValues
, to do that, simply change its declaration to the following
Your guess is correct, `void PrintValues(const std::string& title, std::vector>& v, std::ofstream& outfil)