Issue with interator incrementation

I'm having some trouble with the ++ operator. I don't think it's working property because I'm to be getting suck in a loop. Here's what I have:
1
2
3
Set::Iterator Set::Iterator::operator++(int){
return Iterator( _cur->next );
}

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.
1
2
3
4
5
6
7
8
9
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
}

Topic archived. No new replies allowed.