<?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[Mysteriöser std::list Fehler]]></title><description><![CDATA[<p>Hab ein kleines Problem<br />
Ich habe eine Klasse 1 in der eine std::list mit Zeigern auf Elemente der Klasse 2 verwaltet wird.</p>
<p>in K1 (private), K2 = Population</p>
<p>std::list&lt;Population*&gt; Populationen;</p>
<p>Immer wenn ich in K1 irgendwie die Liste verwende stürtzt das Programm ab (push_back, clear)</p>
<p>Die Klasse K2 lässt sich problemlos erstellen.<br />
Wenn ich die liste in Main() anlege habe ich ebenfalls keine Probleme.</p>
<p>Wenn es hilfreich ist kann ich noch Backtrace bzw Memorymap posten</p>
<p>Hat jemand eine Idee woran es liegen kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/254412/mysteriöser-std-list-fehler</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 23:24:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/254412.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 Nov 2009 10:00:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 10:00:57 GMT]]></title><description><![CDATA[<p>Hab ein kleines Problem<br />
Ich habe eine Klasse 1 in der eine std::list mit Zeigern auf Elemente der Klasse 2 verwaltet wird.</p>
<p>in K1 (private), K2 = Population</p>
<p>std::list&lt;Population*&gt; Populationen;</p>
<p>Immer wenn ich in K1 irgendwie die Liste verwende stürtzt das Programm ab (push_back, clear)</p>
<p>Die Klasse K2 lässt sich problemlos erstellen.<br />
Wenn ich die liste in Main() anlege habe ich ebenfalls keine Probleme.</p>
<p>Wenn es hilfreich ist kann ich noch Backtrace bzw Memorymap posten</p>
<p>Hat jemand eine Idee woran es liegen kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808664</guid><dc:creator><![CDATA[yodakohl]]></dc:creator><pubDate>Mon, 16 Nov 2009 10:00:57 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 10:24:06 GMT]]></title><description><![CDATA[<p>Du kannst uns einen auf das Wesentliche reduzierten Sourcecode zeigen, der den Fehler auch zeigt. Unsere Glaskugeln sind zur Zeit alle in der Reinigung und zu raten ist immer so ungenau.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808673</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Mon, 16 Nov 2009 10:24:06 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 10:37:37 GMT]]></title><description><![CDATA[<p>Die Übergeordnete Klasse</p>
<pre><code>#ifndef WELT_H
#define WELT_H
#include &lt;list&gt;
#include&quot;population.h&quot;

class Welt
{
public: 

    void create_Population(); //HALTEPUNKT 1

private:

    std::list&lt;Population*&gt; Populationen;
};

#endif // WELT_H
</code></pre>
<p>Die untergeordnete Klasse ( Population )</p>
<pre><code>#ifndef POPULATION_H
#define POPULATION_H
#include &quot;lebewesen.h&quot;
#include &quot;sensor.h&quot;
#include &quot;aktor.h&quot;
#include &quot;emitter.h&quot;
#include &lt;list&gt;
class Population{

public:

        //einige public Funktionen

private:
       std::list&lt;Lebewesen*&gt; Bestand;
       std::list&lt;emitter*&gt; emitters;
       std::list&lt;int&gt; avg_fitness;
       std::list&lt;int&gt; best_fitness;
       int max_worm;

};
</code></pre>
<p>In HALTEPUNKT 1 will ich ein Element der Klasse Population dynamisch erstellen und zu Liste Populationen hinzufügen. Leider verweigert mir die Liste jeglichen Dienst, das Programm stürzt bei jeder Listenoperation kommentarlos ab.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808679</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808679</guid><dc:creator><![CDATA[yodakohl]]></dc:creator><pubDate>Mon, 16 Nov 2009 10:37:37 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 10:41:19 GMT]]></title><description><![CDATA[<p>Und der Code von create_Population()?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808682</guid><dc:creator><![CDATA[chris_phz]]></dc:creator><pubDate>Mon, 16 Nov 2009 10:41:19 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 10:44:44 GMT]]></title><description><![CDATA[<pre><code>Population *Pop = new Population;
this-&gt;Populationen.push_back(Pop);
</code></pre>
<p>Bei push_back stürzt das Programm ab</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808683</guid><dc:creator><![CDATA[yoakohl]]></dc:creator><pubDate>Mon, 16 Nov 2009 10:44:44 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 11:12:23 GMT]]></title><description><![CDATA[<p>Tipp: Falscher Operator.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808697</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808697</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Mon, 16 Nov 2009 11:12:23 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 11:38:51 GMT]]></title><description><![CDATA[<p>hm grübel<br />
this ist ein Zeiger und benötigt dementsprechend einen Pfeil. Damit habe ich bereits referenziert und deshalb sollte auch der Punkt danach stimmen. Oder meinst du etwas anderes</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808711</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808711</guid><dc:creator><![CDATA[yodakohl]]></dc:creator><pubDate>Mon, 16 Nov 2009 11:38:51 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 13:14:39 GMT]]></title><description><![CDATA[<p>Achso, ja - sorry, hab mich verlesen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808754</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808754</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Mon, 16 Nov 2009 13:14:39 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 13:26:26 GMT]]></title><description><![CDATA[<p>Mir fällt nix falsches auf. Minimalbeispiel kompiliert auch ohne Probs:</p>
<pre><code class="language-cpp">#include &lt;list&gt;

//Inhalt irrelevant
class foo
{
public:
private:
};

class a
{
public:
	void create()
	{
		foo *fong = new foo;
		this-&gt;fuck.push_back(fong);
                this-&gt;fuck.pop_back(fong);
	}

private:
	std::list&lt;foo*&gt; fuck;
};

int main()
{
	a b; 
	b.create();
	return 0;
}
</code></pre>
<p><strong>Irgendetwas</strong> weggelassen?</p>
<p>edit: Sicher, dass der Fehler bei push_back auftritt? Was macht der Konstruktor von Population?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808760</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808760</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Mon, 16 Nov 2009 13:26:26 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 14:40:28 GMT]]></title><description><![CDATA[<p>Der Konstruktor mach nicht viel: Population(){max_worm = 0;}</p>
<p>Allerdings ist mir gerade folgendes aufgefallen. Bei der Überwachung der lokalen Variablen :</p>
<p>Populationen &lt;nicht im Bereich&gt;<br />
emitters &lt;nicht im Bereich&gt;</p>
<p>hier sollte eigentlich &lt; 0 items&gt; stehen</p>
<p>Aussderdem steht statt einem hexwert für die Adresse der Liste kein Wert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808820</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808820</guid><dc:creator><![CDATA[yodakohl]]></dc:creator><pubDate>Mon, 16 Nov 2009 14:40:28 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 14:45:23 GMT]]></title><description><![CDATA[<p>Ok Problem gelöst. Habe Klasse Welt falsch initialisiert. Die zuweisung des Zeiger erfolgte erst nach dem Aufruf create_population(). Somit hatte der Zeiger auf die Klasse Welt einen undefinierten Wert.</p>
<p>Danke für die vielen Antworten. Eigentlich hätte ich das früher merken sollen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1808824</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1808824</guid><dc:creator><![CDATA[yodakohl]]></dc:creator><pubDate>Mon, 16 Nov 2009 14:45:23 GMT</pubDate></item><item><title><![CDATA[Reply to Mysteriöser std::list Fehler on Mon, 16 Nov 2009 21:30:23 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile-var-mode-is-viewprofile-and-u-is-1819.html" rel="nofollow">rüdiger</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-8.html" rel="nofollow">Rund um die Programmierung</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum-var-f-is-15.html" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39405.html" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1809063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1809063</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 16 Nov 2009 21:30:23 GMT</pubDate></item></channel></rss>