Here's everything that I can imagine is relevant from my code:
Is there a header I'm missing? Any suggestions what I'm doing wrong? Is there a bug with Clang or the C++ STL?
(Am I the only one who feels like C and C++ both suck at handling text and files and that tasks that should be trivial pertaining to them just aren't?)
Code:
#include <fstream>
#include <iostream>
class knapsack
{
public:
// ... more functions above ...
ostream putSolutionIn(ostream &ostr) const;
// ... more functions below ...
};
// implementations that I don't think are relevant...
ostream knapsack::putSolutionIn(ostream &ostr) const
{
ostr << "Total value: " << getValue() << endl;
ostr << "Total cost: " << getCost() << endl << endl;
// Print out objects in the solution
for (int i = 0, n = getNumObjects(); i < n; i++)
{
if (isSelected(i))
{
ostr << i << " " << getValue(i) << " " << getCost(i) << endl;
}
}
[b]return ostr;[/b] [color=red]// Error: Call to implicitly-deleted copy constructor of 'ostream' (aka 'basic_ostream<char>')[/color]
}
Is there a header I'm missing? Any suggestions what I'm doing wrong? Is there a bug with Clang or the C++ STL?
(Am I the only one who feels like C and C++ both suck at handling text and files and that tasks that should be trivial pertaining to them just aren't?)
Last edited: