Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*foo)[index] = bar;
- foo->insert(std::pair<KeyType,ValueType>(myKey, myValue));
- ...
- typedef std::map<int, SCNode*> SCNodeMap;
- ...
- void StemAndCycle::getCycleNodes(SCNodeMap* cycleNodes)
- {
- (*cycleNodes)[root->getId()] = root;
- SCNode* tmp = root->getSucc();
- while(tmp->getId() != root->getId())
- {
- // (*cycleNodes)[tmp->getId()] == tmp; // crashes (in loop below)
- cycleNodes->insert(std::pair<int, SCNode*>(tmp->getId(), tmp));//OK
- std::pair<int, SCNode*> it = *(cycleNodes->find(tmp->getId()));
- tmp = tmp->getSucc();
- }
- // debugging; print ids of all the SCNode objects in the collection
- std::map<int, SCNode*>::iterator it = cycleNodes->begin();
- while(it != cycleNodes->end())
- {
- std::pair<int, SCNode*> p = (*it);
- SCNode* tmp = (*it).second; // null except for it = cycleNodes->begin()
- std::cout << "tmp node id: "<<tmp->getId()<<std::endl;
- it++;
- }
- }
- (*cycleNodes)[tmp->getId()] == tmp;
- (*cycleNodes)[tmp->getId()] = tmp;
- if ( amap[x] == 42 ) {
- ...
- }
Add Comment
Please, Sign In to add comment