# HG changeset patch
# User Alpar Juttner <alpar@cs.elte.hu>
# Date 1396968869 -7200
# Tue Apr 08 16:54:29 2014 +0200
# Node ID 51deaff8728aacb20463ace3626807877d608611
# Parent e00d7b681d8e8fa6cc94353e9b30388b27138043
Clang compatibility fix in lgf-gen.cc (#480)
diff --git a/tools/lgf-gen.cc b/tools/lgf-gen.cc
|
a
|
b
|
|
| 246 | 246 | |
| 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; |
| 252 | 252 | |
| … |
… |
|
| 329 | 329 | Beach::iterator bit = beach.upper_bound(Part(site, site, site)); |
| 330 | 330 | |
| 331 | 331 | if (bit->second != spikeheap.end()) { |
| | 332 | delete bit->second->second; |
| 332 | 333 | spikeheap.erase(bit->second); |
| 333 | 334 | } |
| 334 | 335 | |
| … |
… |
|
| 342 | 343 | if (prev != -1 && |
| 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 { |
| 349 | 350 | beach.insert(std::make_pair(Part(prev, curr, site), pit)); |
| … |
… |
|
| 355 | 356 | if (next != -1 && |
| 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 { |
| 362 | 363 | beach.insert(std::make_pair(Part(site, curr, next), nit)); |
| … |
… |
|
| 366 | 367 | } 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; |
| 372 | 373 | int curr = bit->first.curr; |
| … |
… |
|
| 399 | 400 | Beach::iterator nbit = bit; ++nbit; |
| 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); |
| 408 | 421 | beach.erase(pbit); |
| … |
… |
|
| 412 | 425 | circle_form(points[ppv], points[prev], points[next])) { |
| 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 { |
| 419 | 432 | beach.insert(std::make_pair(Part(ppv, prev, next), pit)); |
| … |
… |
|
| 424 | 437 | circle_form(points[prev], points[next], points[nnt])) { |
| 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 { |
| 431 | 444 | beach.insert(std::make_pair(Part(prev, next, nnt), nit)); |