I'm trying to make the container to work with one of my classes. But i don't understand what should the overloaded operator contain. Maybe this is because i don't know the container too well... Please give me some insights.
This is my class
class Complex{
private:
int re;
int im;
public:
void init(int _re, int _im){
re= _re;
im= _im;
}
Complex(int _re, int _im){
init (_re, _im);
}
int getRe(){
return re;
}
int getIm(){
return im;
}
void setRe(int _re){
re = _re;
}
void setIm(int _im){
im = _im;
}
};
This is what i'm trying to do.
for(cpos = m3->begin();cpos !=m3->end(); cpos++){
cout<< *cpos << ' ';
}
where m3 is of type multiset<Complex>*
and cpos is multiset<Complex>::iterator*
and this is the error:
no match for ‘operator<<’ in ‘std::cout << cpos.std::_Rb_tree_const_iterator<_Tp>::operator* [with _Tp = Complex]()’