Clang compatibility fix in lgf-gen.cc (#480)
authorAlpar Juttner <alpar@cs.elte.hu>
Tue, 08 Apr 2014 16:54:29 +0200
changeset 130889e1877e335f
parent 1288 dd5b5d96b657
child 1309 489e243cfcb7
child 1364 4124fe8ef8de
Clang compatibility fix in lgf-gen.cc (#480)
tools/lgf-gen.cc
     1.1 --- a/tools/lgf-gen.cc	Sun Aug 11 17:21:22 2013 +0200
     1.2 +++ b/tools/lgf-gen.cc	Tue Apr 08 16:54:29 2014 +0200
     1.3 @@ -246,7 +246,7 @@
     1.4  
     1.5    struct BeachIt;
     1.6  
     1.7 -  typedef std::multimap<double, BeachIt> SpikeHeap;
     1.8 +  typedef std::multimap<double, BeachIt*> SpikeHeap;
     1.9  
    1.10    typedef std::multimap<Part, SpikeHeap::iterator, YLess> Beach;
    1.11  
    1.12 @@ -329,6 +329,7 @@
    1.13        Beach::iterator bit = beach.upper_bound(Part(site, site, site));
    1.14  
    1.15        if (bit->second != spikeheap.end()) {
    1.16 +        delete bit->second->second;
    1.17          spikeheap.erase(bit->second);
    1.18        }
    1.19  
    1.20 @@ -342,8 +343,8 @@
    1.21        if (prev != -1 &&
    1.22            circle_form(points[prev], points[curr], points[site])) {
    1.23          double x = circle_point(points[prev], points[curr], points[site]);
    1.24 -        pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
    1.25 -        pit->second.it =
    1.26 +        pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
    1.27 +        pit->second->it =
    1.28            beach.insert(std::make_pair(Part(prev, curr, site), pit));
    1.29        } else {
    1.30          beach.insert(std::make_pair(Part(prev, curr, site), pit));
    1.31 @@ -355,8 +356,8 @@
    1.32        if (next != -1 &&
    1.33            circle_form(points[site], points[curr],points[next])) {
    1.34          double x = circle_point(points[site], points[curr], points[next]);
    1.35 -        nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
    1.36 -        nit->second.it =
    1.37 +        nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
    1.38 +        nit->second->it =
    1.39            beach.insert(std::make_pair(Part(site, curr, next), nit));
    1.40        } else {
    1.41          beach.insert(std::make_pair(Part(site, curr, next), nit));
    1.42 @@ -366,7 +367,7 @@
    1.43      } else {
    1.44        sweep = spit->first;
    1.45  
    1.46 -      Beach::iterator bit = spit->second.it;
    1.47 +      Beach::iterator bit = spit->second->it;
    1.48  
    1.49        int prev = bit->first.prev;
    1.50        int curr = bit->first.curr;
    1.51 @@ -399,10 +400,22 @@
    1.52        Beach::iterator nbit = bit; ++nbit;
    1.53        int nnt = nbit->first.next;
    1.54  
    1.55 -      if (bit->second != spikeheap.end()) spikeheap.erase(bit->second);
    1.56 -      if (pbit->second != spikeheap.end()) spikeheap.erase(pbit->second);
    1.57 -      if (nbit->second != spikeheap.end()) spikeheap.erase(nbit->second);
    1.58 -
    1.59 +      if (bit->second != spikeheap.end())
    1.60 +        {
    1.61 +          delete bit->second->second;
    1.62 +          spikeheap.erase(bit->second);
    1.63 +        }
    1.64 +      if (pbit->second != spikeheap.end())
    1.65 +        {
    1.66 +          delete pbit->second->second;
    1.67 +          spikeheap.erase(pbit->second);
    1.68 +        }
    1.69 +      if (nbit->second != spikeheap.end())
    1.70 +        {
    1.71 +          delete nbit->second->second;
    1.72 +          spikeheap.erase(nbit->second);
    1.73 +        }
    1.74 +      
    1.75        beach.erase(nbit);
    1.76        beach.erase(bit);
    1.77        beach.erase(pbit);
    1.78 @@ -412,8 +425,8 @@
    1.79            circle_form(points[ppv], points[prev], points[next])) {
    1.80          double x = circle_point(points[ppv], points[prev], points[next]);
    1.81          if (x < sweep) x = sweep;
    1.82 -        pit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
    1.83 -        pit->second.it =
    1.84 +        pit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
    1.85 +        pit->second->it =
    1.86            beach.insert(std::make_pair(Part(ppv, prev, next), pit));
    1.87        } else {
    1.88          beach.insert(std::make_pair(Part(ppv, prev, next), pit));
    1.89 @@ -424,8 +437,8 @@
    1.90            circle_form(points[prev], points[next], points[nnt])) {
    1.91          double x = circle_point(points[prev], points[next], points[nnt]);
    1.92          if (x < sweep) x = sweep;
    1.93 -        nit = spikeheap.insert(std::make_pair(x, BeachIt(beach.end())));
    1.94 -        nit->second.it =
    1.95 +        nit = spikeheap.insert(std::make_pair(x, new BeachIt(beach.end())));
    1.96 +        nit->second->it =
    1.97            beach.insert(std::make_pair(Part(prev, next, nnt), nit));
    1.98        } else {
    1.99          beach.insert(std::make_pair(Part(prev, next, nnt), nit));