I'm writing this code and I'm getting this error:
[Error] passing 'const std::vector' as 'this' argument of 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = metastock7, _Alloc = std::allocator, std::vector<_Tp, _Alloc>::value_type = metastock7]' discards qualifiers [-fpermissive]
struct A{
string name;
vector<B> rows;
};
set<A, classcomp> set;
vector<B> data; //I filled the vector in my code
std::set<A, classcomp>::iterator it;
std::pair<std::set<A, classcomp>::iterator,bool> ret;
for(int i = 0; i < data.size(); i++){
A a;
B b = data[i];
a.name= b.name;
ret = set.insert(a);
it = ret.first;
(*it).rows.push_back(b); //IT COMPILES WITHOUT
// it->rows.push_back(mstk7); //fails as well
}
I really don't understand the error. Can you please help?
Thank you.