I'm writing a program which includes a 2D vector of objects:
class Obj{
public:
int x;
string y;
};
vector<Obj> a(100);
vector< vector<Obj> > b(10);
I've stored some values of vector a in vector b.
I get an error when I try to print it out like this:
for(int i=0; i<b.size(); i++){
for(int j=0; j<b[i].size(); j++)
cout << b[i][j];
cout << endl;
}
error info:
D:\main.cpp:91: error: no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream}' and '__gnu_cxx::__alloc_traits >::value_type {aka Obj}') cout << b[i][j]; ^