I get a segmentation fault when iterating over a set. The stack trace points to
std::_Rb_tree_const_iterator<Type>::operator++
std::_Rb_tree_increment()
but I get nothing more informative. The iterator is over a set returned by a function
for (FactSet::factset_iterator fact_it = (*binSet_it).getDependencyGraph().getExtentionalFactSet().begin();
fact_it != (*binSet_it).getDependencyGraph().getExtentionalFactSet().end();
++fact_it) {...}
I cannot see the issue.
Thanks in advance.
You don’t want to be iterating over the return value like that. The middle termination condition is re-evaluated every iteration, so your
end()will be for a different set every time, which means your iterator will never reach it.Cache the set in a local variable and then use the
begin()andend()from that.