Changeset 1109:89e1877e335f in lemon-main
- Timestamp:
- 04/08/14 16:54:29 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/lgf-gen.cc
r654 r1109 247 247 struct BeachIt; 248 248 249 typedef std::multimap<double, BeachIt > SpikeHeap;249 typedef std::multimap<double, BeachIt*> SpikeHeap; 250 250 251 251 typedef std::multimap<Part, SpikeHeap::iterator, YLess> Beach; … … 330 330 331 331 if (bit->second != spikeheap.end()) { 332 delete bit->second->second; 332 333 spikeheap.erase(bit->second); 333 334 } … … 343 344 circle_form(points[prev], points[curr], points[site])) { 344 345 double x = circle_point(points[prev], points[curr], points[site]); 345 pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));346 pit->second .it =346 pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end()))); 347 pit->second->it = 347 348 beach.insert(std::make_pair(Part(prev, curr, site), pit)); 348 349 } else { … … 356 357 circle_form(points[site], points[curr],points[next])) { 357 358 double x = circle_point(points[site], points[curr], points[next]); 358 nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));359 nit->second .it =359 nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end()))); 360 nit->second->it = 360 361 beach.insert(std::make_pair(Part(site, curr, next), nit)); 361 362 } else { … … 367 368 sweep = spit->first; 368 369 369 Beach::iterator bit = spit->second .it;370 Beach::iterator bit = spit->second->it; 370 371 371 372 int prev = bit->first.prev; … … 400 401 int nnt = nbit->first.next; 401 402 402 if (bit->second != spikeheap.end()) spikeheap.erase(bit->second); 403 if (pbit->second != spikeheap.end()) spikeheap.erase(pbit->second); 404 if (nbit->second != spikeheap.end()) spikeheap.erase(nbit->second); 405 403 if (bit->second != spikeheap.end()) 404 { 405 delete bit->second->second; 406 spikeheap.erase(bit->second); 407 } 408 if (pbit->second != spikeheap.end()) 409 { 410 delete pbit->second->second; 411 spikeheap.erase(pbit->second); 412 } 413 if (nbit->second != spikeheap.end()) 414 { 415 delete nbit->second->second; 416 spikeheap.erase(nbit->second); 417 } 418 406 419 beach.erase(nbit); 407 420 beach.erase(bit); … … 413 426 double x = circle_point(points[ppv], points[prev], points[next]); 414 427 if (x < sweep) x = sweep; 415 pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));416 pit->second .it =428 pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end()))); 429 pit->second->it = 417 430 beach.insert(std::make_pair(Part(ppv, prev, next), pit)); 418 431 } else { … … 425 438 double x = circle_point(points[prev], points[next], points[nnt]); 426 439 if (x < sweep) x = sweep; 427 nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));428 nit->second .it =440 nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end()))); 441 nit->second->it = 429 442 beach.insert(std::make_pair(Part(prev, next, nnt), nit)); 430 443 } else {
Note: See TracChangeset
for help on using the changeset viewer.