where, contourPoint is a structure I defined (contains a valid copy constructor as well). the program runs just fine in release mode, but in the debug mode, I get the following error
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1
2
/usr/include/c++/4.2.1/debug/safe_iterator.h:164:error: attempt to copy
from a singular iterator.
Objects involved in the operation:
iterator "this" @ 0x0x7fff5fbfdb28 {
type = N11__gnu_debug14_Safe_iteratorISt23_Rb_tree_const_iteratorISt4pairIiiEENSt7__debug3setIS3_St4lessIS3_ESaIS3_EEEEE (mutable iterator);
state = singular;
}
iterator "other" @ 0x0x7fff5fbfda58 {
type = N11__gnu_debug14_Safe_iteratorISt23_Rb_tree_const_iteratorISt4pairIiiEENSt7__debug3setIS3_St4lessIS3_ESaIS3_EEEEE (mutable iterator);
state = singular;
}
Abort
It doesnt even give me the line number, so I printed 1,2,3 to see what line it breaks only on the commandline.
Any ideas as to how to fix this ? Googling didnt help me much here.
//================================================================
// a point on the contour : can only exist on a vertex or an edge
class contourPoint{
bool isVertex;
int V;
set<Edge>::const_iterator edge;
double alpha;
public:
contourPoint(){
V = -1;
isVertex = true;
}
contourPoint(int v_){
V = v_;
isVertex = true;
}
contourPoint::contourPoint(const contourPoint& p) {
V = p.get_V();
isVertex = p.is_onVertex();
}
contourPoint(set<Edge>::const_iterator ed, double alp){
V = -1;
isVertex = false;
edge = ed;
alpha = alp;
}
could it be that the second constructor does not initialize the iterator edge which creates a problem ? I dont want to use the iterator if I call the second constructor. Is there a default/null value I can assign to the iterator ?
Because in your version there is first an uninitalized iterator created which is later assigned a valid iterator. Maybe your compiler complains about this.