I get a segmentation fault when iterating over a set.
The stack trace points to:
0x000000081193ccc5 in std::_Rb_tree_increment (__x=0x1) at /libstdc++/src/tree.cc:68
0x0000000806c3107e in std::_Rb_tree_const_iterator<test *>::operator++ at stl_tree.h:266
but I get nothing more informative but the last line of crash is as below.
The iterator is over a set.
typedef std::set<test*,test_less> test_set_t;
test_set_t& set(bt->getSet()); // getSet() will return reference to the class bt member variable set
test_set_t::iterator pos = set.begin();
test empty(val);
test* last_ptr = ∅
for (; pos != set.end(); last_ptr = *pos++) { // gdb shows this as last line
I cannot see the issue. Thanks in advance.
Most likely either the set is empty or you erased the item
poswas pointing to while iterating.