COIN-OR::LEMON - Graph Library

Ticket #480: 51deaff8728a.patch

File 51deaff8728a.patch, 4.0 KB (added by Alpar Juttner, 11 years ago)
  • tools/lgf-gen.cc

    # 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  
    246246
    247247  struct BeachIt;
    248248
    249   typedef std::multimap<double, BeachIt> SpikeHeap;
     249  typedef std::multimap<double, BeachIt*> SpikeHeap;
    250250
    251251  typedef std::multimap<Part, SpikeHeap::iterator, YLess> Beach;
    252252
     
    329329      Beach::iterator bit = beach.upper_bound(Part(site, site, site));
    330330
    331331      if (bit->second != spikeheap.end()) {
     332        delete bit->second->second;
    332333        spikeheap.erase(bit->second);
    333334      }
    334335
     
    342343      if (prev != -1 &&
    343344          circle_form(points[prev], points[curr], points[site])) {
    344345        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 =
    347348          beach.insert(std::make_pair(Part(prev, curr, site), pit));
    348349      } else {
    349350        beach.insert(std::make_pair(Part(prev, curr, site), pit));
     
    355356      if (next != -1 &&
    356357          circle_form(points[site], points[curr],points[next])) {
    357358        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 =
    360361          beach.insert(std::make_pair(Part(site, curr, next), nit));
    361362      } else {
    362363        beach.insert(std::make_pair(Part(site, curr, next), nit));
     
    366367    } else {
    367368      sweep = spit->first;
    368369
    369       Beach::iterator bit = spit->second.it;
     370      Beach::iterator bit = spit->second->it;
    370371
    371372      int prev = bit->first.prev;
    372373      int curr = bit->first.curr;
     
    399400      Beach::iterator nbit = bit; ++nbit;
    400401      int nnt = nbit->first.next;
    401402
    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     
    406419      beach.erase(nbit);
    407420      beach.erase(bit);
    408421      beach.erase(pbit);
     
    412425          circle_form(points[ppv], points[prev], points[next])) {
    413426        double x = circle_point(points[ppv], points[prev], points[next]);
    414427        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 =
    417430          beach.insert(std::make_pair(Part(ppv, prev, next), pit));
    418431      } else {
    419432        beach.insert(std::make_pair(Part(ppv, prev, next), pit));
     
    424437          circle_form(points[prev], points[next], points[nnt])) {
    425438        double x = circle_point(points[prev], points[next], points[nnt]);
    426439        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 =
    429442          beach.insert(std::make_pair(Part(prev, next, nnt), nit));
    430443      } else {
    431444        beach.insert(std::make_pair(Part(prev, next, nnt), nit));