komischer fehler!
-
Habe eine vector mit "CAllocation Objekte"
std::vector<CAllocation> 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));Der funktion insert_Event wird eine referenz auf die eine Allocationm übergeben, und darin sollen werte in Allocation gesetetzt werden
CAllocation &o= lAlloc.at(2); Base.insert_Event(o,o.m_dRefStarttime); // HIER <- 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;Die inserer funktion:
void CFlowEvents::insert_Event(CAllocation &oAlloc,double dTime){ insert_Event(m_lFlow[oAlloc.m_iType].begin(),oAlloc,dTime); } void CFlowEvents::insert_Event(WorkEvent_Iter itWhere,CAllocation &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->m_dLeft-= (oAlloc.m_dDuration+dTime); r=itRight->m_dLeft; } //Kein linker Nachbar vorhanden! if(itWhere== (m_lFlow[oAlloc.m_iType].begin())){ l= dTime; } else{ WorkEvent_Iter itLeft(itWhere); --itLeft; itLeft->m_dRight=dTime; } //Einfügen CWorkEvent oEv(m_lFlow[oAlloc.m_iType],oAlloc.m_dDuration,r,l,&oAlloc); WorkEvent_Iter itThis= m_lFlow[oAlloc.m_iType].insert(itWhere,oEv); itThis->MyIter(itThis); oAlloc.MyWorkEvent(&(*itThis)); CWorkEvent *p= oAlloc.m_pWorkEvent; //<--HIER WIRD m_pWorkEvent Zeiger der Allokation gesetzt (durch debuggen korrekt) }nach funktionsende sieh oben ist werd wieder NULL?? wieso , hab doch CALlocation per referenz übergeben!
-
Hab fehler gefunden...;) kann geschlossen werden!