error: attempt to copy-construct an iterator from a singular iterator. [geloest]



  • Hallo

    Ich habe ein Problem, auf das ich bisher nicht gestoßen bin und daher auch Schwierigkeiten habe, es zu lösen. Für ein Projekt habe ich eine Klasse geschrieben (siehe unten), die ich ohne Probleme instanziieren und einsetzen kann. Wenn ich jedoch versuche, einen vector dieser Klasse anzulegen und ein Objekt zu pushen, bekomme ich die Meldung

    /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127:
    error: attempt to copy-construct an iterator from a singular iterator.

    Objects involved in the operation:
    iterator "this" @ 0x0x713610 {
    type = N11__gnu_debug14_Safe_iteratorISt17_Rb_tree_iteratorISt4pairIKj5PointEEN15__gnu_debug_def3mapIjS4_St4lessIjESaIS5_EEEEE (mutable iterator);
    state = singular;
    }
    iterator "other" @ 0x0xbffff564 {
    type = N11__gnu_debug14_Safe_iteratorISt17_Rb_tree_iteratorISt4pairIKj5PointEEN15__gnu_debug_def3mapIjS4_St4lessIjESaIS5_EEEEE (mutable iterator);
    state = singular;
    }

    Die Klasse sieht so aus:

    struct object_3D {
    
    	float min_alpha, min_beta, max_alpha,max_beta,min_r,max_r;
    	void calcBoundingBox();
    	bool bounding_box_valid;
    
    	vector<triangle> triangles;
    	void calcTriangles();
    	bool sup_planes_valid;
    	void drawTriangles();
    
    	// position relativ to starting position defined by the openGL-Creates
    	Point position;
    	void moveBy(Point p);
    	void moveTo(Point p);
    
    	// Geschwindigkeit des Objekts zu einem gegebenen Zeitpunkt
    	Point (*positionFunction)(float t);	
    
    	// bewegt das Model entsprechend der Geschwindigkeit,
    	// die per velocity(t) berechnet wird
    	void move(float t){
    		moveTo(positionFunction(t));
    	}
    
    	void calcSupPlanes();
    
    	vector<Point> p;
    	int* indices; // -1 fuer Ende eines Strips
    	uint indices_cnt;
    
    	// mapping of points (their position in p) to a color
    	map<uint,Point> colors;
    	map<uint,Point>::iterator it;
    
    	void openGLdraw();
    	void (*drawDecoration)(vector<float>* params, Point position);
    
    	// ein paar frei belegbare Parameter (fuer Deco-Funktion)
    	vector<float> draw_parameter;
    
    	// Collision:
    	double rayTrace(R* r,P* is);
    
    	void testRaytrace();
    
    	object_3D(){
    		bounding_box_valid = false;
    		sup_planes_valid = false;
    	}	
    
    	void translate(Point t);
    
    	~object_3D(){
    		delete[] indices;
    	}
    
    };
    

    Triangle und Point sind selbst geschrieben, R und P sind Typen aus der Geometrie-Bibliothek CGAL.

    Die Klasse an sich funktioniert wie sie soll, so dass ich nicht weiss, wonach ich suchen soll.

    Wär nett, wenn man jemand einen Blick drauf werfen würde.

    Nikolas



  • Okay, ich habs gerade selbst gefunden. Ich versuche den unitialisierten Iterator fuer die Map zu kopieren, was anscheinend nicht erlaubt ist.


Anmelden zum Antworten