<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[error: attempt to copy-construct an iterator from a singular iterator. [geloest]]]></title><description><![CDATA[<p>Hallo</p>
<p>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</p>
<blockquote>
<p>/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127:<br />
error: attempt to copy-construct an iterator from a singular iterator.</p>
<p>Objects involved in the operation:<br />
iterator &quot;this&quot; @ 0x0x713610 {<br />
type = N11__gnu_debug14_Safe_iteratorISt17_Rb_tree_iteratorISt4pairIKj5PointEEN15__gnu_debug_def3mapIjS4_St4lessIjESaIS5_EEEEE (mutable iterator);<br />
state = singular;<br />
}<br />
iterator &quot;other&quot; @ 0x0xbffff564 {<br />
type = N11__gnu_debug14_Safe_iteratorISt17_Rb_tree_iteratorISt4pairIKj5PointEEN15__gnu_debug_def3mapIjS4_St4lessIjESaIS5_EEEEE (mutable iterator);<br />
state = singular;<br />
}</p>
</blockquote>
<p>Die Klasse sieht so aus:</p>
<pre><code>struct object_3D {

	float min_alpha, min_beta, max_alpha,max_beta,min_r,max_r;
	void calcBoundingBox();
	bool bounding_box_valid;

	vector&lt;triangle&gt; 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&lt;Point&gt; p;
	int* indices; // -1 fuer Ende eines Strips
	uint indices_cnt;

	// mapping of points (their position in p) to a color
	map&lt;uint,Point&gt; colors;
	map&lt;uint,Point&gt;::iterator it;

	void openGLdraw();
	void (*drawDecoration)(vector&lt;float&gt;* params, Point position);

	// ein paar frei belegbare Parameter (fuer Deco-Funktion)
	vector&lt;float&gt; 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;
	}

};
</code></pre>
<p>Triangle und Point sind selbst geschrieben, R und P sind Typen aus der Geometrie-Bibliothek CGAL.</p>
<p>Die Klasse an sich funktioniert wie sie soll, so dass ich nicht weiss, wonach ich suchen soll.</p>
<p>Wär nett, wenn man jemand einen Blick drauf werfen würde.</p>
<p>Nikolas</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/256476/error-attempt-to-copy-construct-an-iterator-from-a-singular-iterator-geloest</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 07:27:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/256476.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 13 Dec 2009 13:18:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to error: attempt to copy-construct an iterator from a singular iterator. [geloest] on Sun, 13 Dec 2009 13:31:07 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>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</p>
<blockquote>
<p>/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127:<br />
error: attempt to copy-construct an iterator from a singular iterator.</p>
<p>Objects involved in the operation:<br />
iterator &quot;this&quot; @ 0x0x713610 {<br />
type = N11__gnu_debug14_Safe_iteratorISt17_Rb_tree_iteratorISt4pairIKj5PointEEN15__gnu_debug_def3mapIjS4_St4lessIjESaIS5_EEEEE (mutable iterator);<br />
state = singular;<br />
}<br />
iterator &quot;other&quot; @ 0x0xbffff564 {<br />
type = N11__gnu_debug14_Safe_iteratorISt17_Rb_tree_iteratorISt4pairIKj5PointEEN15__gnu_debug_def3mapIjS4_St4lessIjESaIS5_EEEEE (mutable iterator);<br />
state = singular;<br />
}</p>
</blockquote>
<p>Die Klasse sieht so aus:</p>
<pre><code>struct object_3D {

	float min_alpha, min_beta, max_alpha,max_beta,min_r,max_r;
	void calcBoundingBox();
	bool bounding_box_valid;

	vector&lt;triangle&gt; 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&lt;Point&gt; p;
	int* indices; // -1 fuer Ende eines Strips
	uint indices_cnt;

	// mapping of points (their position in p) to a color
	map&lt;uint,Point&gt; colors;
	map&lt;uint,Point&gt;::iterator it;

	void openGLdraw();
	void (*drawDecoration)(vector&lt;float&gt;* params, Point position);

	// ein paar frei belegbare Parameter (fuer Deco-Funktion)
	vector&lt;float&gt; 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;
	}

};
</code></pre>
<p>Triangle und Point sind selbst geschrieben, R und P sind Typen aus der Geometrie-Bibliothek CGAL.</p>
<p>Die Klasse an sich funktioniert wie sie soll, so dass ich nicht weiss, wonach ich suchen soll.</p>
<p>Wär nett, wenn man jemand einen Blick drauf werfen würde.</p>
<p>Nikolas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1821947</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821947</guid><dc:creator><![CDATA[Nikolas]]></dc:creator><pubDate>Sun, 13 Dec 2009 13:31:07 GMT</pubDate></item><item><title><![CDATA[Reply to error: attempt to copy-construct an iterator from a singular iterator. [geloest] on Sun, 13 Dec 2009 13:30:44 GMT]]></title><description><![CDATA[<p>Okay, ich habs gerade selbst gefunden. Ich versuche den unitialisierten Iterator fuer die Map zu kopieren, was anscheinend nicht erlaubt ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1821949</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821949</guid><dc:creator><![CDATA[Nikolas]]></dc:creator><pubDate>Sun, 13 Dec 2009 13:30:44 GMT</pubDate></item></channel></rss>