I'm trying to write vector's members to file but I get this error for loop operation:
no operator "<<" matches these operands
How can I write those members to file?
std::ofstream raport;
raport.open("test.txt", std::ios_base::app);
std::vector<std::vector<float>> targetInputs = {
{0.0f, 0.0f},
{1.0f, 1.0f},
{1.0f, 0.0f},
{0.0f, 1.0f}
};
for (int i = 0;i < targetInputs.size(); i++) {
raport << targetInputs[i];
}
Example with range based for loop. The const references are there since output should never modify the input data. The ostringstream is a standin stream for your file.