Hi, I'm new around these parts. I've been doing something for uni and I've been making very steady progress on an assignment until I ran into this little problem. Might be trivial, but staring at it for the last hour doesn't make it any easier.

I'm trying to use set_intersection, but this const error is there. I don't know where else to look to rectify this problem? Can someone shed some light on this please?

Thanks in advance,

Somedude.

Code:/usr/include/c++/4.0.0/bits/stl_algo.h: In function ‘_OutputIterator std::set_intersection(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2, _OutputIterator) [with _InputIterator1 = std::_Rb_tree_const_iterator<Hit>, _InputIterator2 = std::_Rb_tree_const_iterator<Hit>, _OutputIterator = std::_Rb_tree_const_iterator<Hit>]’: /trunk/subNode.cc:171: instantiated from here /usr/include/c++/4.0.0/bits/stl_algo.h:4233: error: passing ‘const Hit’ as ‘this’ argument of ‘Hit& Hit::operator=(const Hit&)’ discards qualifiersCode:Hits evaluate(Hits left_list, Hits right_list, Operation op) { Hits result; //vector<Hit>::iterator it_left, it_right; switch (op) { case '0' : // 'AND' operator set_intersection( left_list.results.begin(), left_list.results.end(), right_list.results.begin(), right_list.results.end(), result.results.begin() );<-- error occurs herereturn result; break; ...Code:class Hits { public: Hits() {} std::set<Hit> results; void add(Hit h) { results.insert(h); } };