<?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[komischer fehler!]]></title><description><![CDATA[<p>Habe eine vector mit &quot;CAllocation Objekte&quot;</p>
<pre><code class="language-cpp">std::vector&lt;CAllocation&gt; lAlloc;
	lAlloc.push_back(CAllocation(950,250,1));
	lAlloc.push_back(CAllocation(700,100,1));
	lAlloc.push_back(CAllocation(1400,300,1));
	lAlloc.push_back(CAllocation(150,50,1));
	lAlloc.push_back(CAllocation(400,200,1));
</code></pre>
<p>Der funktion insert_Event wird eine referenz auf die eine Allocationm übergeben, und darin sollen werte in Allocation gesetetzt werden</p>
<pre><code class="language-cpp">CAllocation &amp;o= lAlloc.at(2);
	Base.insert_Event(o,o.m_dRefStarttime);
// HIER &lt;- Problem, nach dem in der funktion insert_Event (siehe unten) die Allocation verändert wurde, ist die variabel m_pWorkEvent nach dem funktion aufrufe wieder NULL;
</code></pre>
<p>Die inserer funktion:</p>
<pre><code class="language-cpp">void CFlowEvents::insert_Event(CAllocation &amp;oAlloc,double dTime){
		insert_Event(m_lFlow[oAlloc.m_iType].begin(),oAlloc,dTime);
}

void CFlowEvents::insert_Event(WorkEvent_Iter itWhere,CAllocation &amp;oAlloc,double dTime){

	double r=0;
	double l=0;

	//Kein rechter Nachbar vorhanden
	if(itWhere==(m_lFlow[oAlloc.m_iType].end()))
		r=ULONG_MAX;	//Link unendliche abstand
	else{
		WorkEvent_Iter itRight(itWhere);
		//++itRight;
		itRight-&gt;m_dLeft-= (oAlloc.m_dDuration+dTime);
		r=itRight-&gt;m_dLeft;
	}

	//Kein linker Nachbar vorhanden!
	if(itWhere== (m_lFlow[oAlloc.m_iType].begin())){
		l= dTime;		
	}
	else{
		WorkEvent_Iter itLeft(itWhere);
		--itLeft;
		itLeft-&gt;m_dRight=dTime;
	}

	//Einfügen
	CWorkEvent oEv(m_lFlow[oAlloc.m_iType],oAlloc.m_dDuration,r,l,&amp;oAlloc);
	WorkEvent_Iter itThis= m_lFlow[oAlloc.m_iType].insert(itWhere,oEv);
	itThis-&gt;MyIter(itThis);
	oAlloc.MyWorkEvent(&amp;(*itThis));
	CWorkEvent *p= oAlloc.m_pWorkEvent; //&lt;--HIER WIRD m_pWorkEvent Zeiger der Allokation gesetzt (durch debuggen korrekt) 
}
</code></pre>
<p>nach funktionsende sieh oben ist werd wieder NULL?? wieso , hab doch CALlocation per referenz übergeben!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/195363/komischer-fehler</link><generator>RSS for Node</generator><lastBuildDate>Tue, 29 Sep 2026 21:55:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/195363.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 Oct 2007 05:10:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to komischer fehler! on Wed, 17 Oct 2007 05:11:38 GMT]]></title><description><![CDATA[<p>Habe eine vector mit &quot;CAllocation Objekte&quot;</p>
<pre><code class="language-cpp">std::vector&lt;CAllocation&gt; lAlloc;
	lAlloc.push_back(CAllocation(950,250,1));
	lAlloc.push_back(CAllocation(700,100,1));
	lAlloc.push_back(CAllocation(1400,300,1));
	lAlloc.push_back(CAllocation(150,50,1));
	lAlloc.push_back(CAllocation(400,200,1));
</code></pre>
<p>Der funktion insert_Event wird eine referenz auf die eine Allocationm übergeben, und darin sollen werte in Allocation gesetetzt werden</p>
<pre><code class="language-cpp">CAllocation &amp;o= lAlloc.at(2);
	Base.insert_Event(o,o.m_dRefStarttime);
// HIER &lt;- Problem, nach dem in der funktion insert_Event (siehe unten) die Allocation verändert wurde, ist die variabel m_pWorkEvent nach dem funktion aufrufe wieder NULL;
</code></pre>
<p>Die inserer funktion:</p>
<pre><code class="language-cpp">void CFlowEvents::insert_Event(CAllocation &amp;oAlloc,double dTime){
		insert_Event(m_lFlow[oAlloc.m_iType].begin(),oAlloc,dTime);
}

void CFlowEvents::insert_Event(WorkEvent_Iter itWhere,CAllocation &amp;oAlloc,double dTime){

	double r=0;
	double l=0;

	//Kein rechter Nachbar vorhanden
	if(itWhere==(m_lFlow[oAlloc.m_iType].end()))
		r=ULONG_MAX;	//Link unendliche abstand
	else{
		WorkEvent_Iter itRight(itWhere);
		//++itRight;
		itRight-&gt;m_dLeft-= (oAlloc.m_dDuration+dTime);
		r=itRight-&gt;m_dLeft;
	}

	//Kein linker Nachbar vorhanden!
	if(itWhere== (m_lFlow[oAlloc.m_iType].begin())){
		l= dTime;		
	}
	else{
		WorkEvent_Iter itLeft(itWhere);
		--itLeft;
		itLeft-&gt;m_dRight=dTime;
	}

	//Einfügen
	CWorkEvent oEv(m_lFlow[oAlloc.m_iType],oAlloc.m_dDuration,r,l,&amp;oAlloc);
	WorkEvent_Iter itThis= m_lFlow[oAlloc.m_iType].insert(itWhere,oEv);
	itThis-&gt;MyIter(itThis);
	oAlloc.MyWorkEvent(&amp;(*itThis));
	CWorkEvent *p= oAlloc.m_pWorkEvent; //&lt;--HIER WIRD m_pWorkEvent Zeiger der Allokation gesetzt (durch debuggen korrekt) 
}
</code></pre>
<p>nach funktionsende sieh oben ist werd wieder NULL?? wieso , hab doch CALlocation per referenz übergeben!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1386796</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1386796</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Wed, 17 Oct 2007 05:11:38 GMT</pubDate></item><item><title><![CDATA[Reply to komischer fehler! on Wed, 17 Oct 2007 05:42:39 GMT]]></title><description><![CDATA[<p>Hab fehler gefunden...;) kann geschlossen werden!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1386811</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1386811</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Wed, 17 Oct 2007 05:42:39 GMT</pubDate></item></channel></rss>