I don't understand how this could be failing but I'm almost certain this is the source of my problem. When I run the program using << I just get the first value repeated until I kill the program.
1 2 3 4 5 6 7
ostream& operator<<(ostream& out, Set& v){
for( Set::Iterator it = v.begin(); it != v.end(); it++ ){
out << *it << " ";
}
out << endl;
return out;
}
Here's << but all methods involving ++ fail. Hope you can provide some insight.
Set::Iterator Set::Iterator::operator++(int) {
Set::Iterator old_value( *this ) ; // make a copy of the iterator
// *** important: operator++(int) should increment the iterator
_cur = _cur->next ; // modify the iterator so that it 'points' to the next element
return old_value ; // return the old value before the increment
}