Changeset 320


Ignore:
Timestamp:
Mar 26, 2010 3:12:20 PM (10 years ago)
Author:
stefan
Message:

fix for MS compiler: iterator in a vector gets invalidated if some element is erased from the vector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/0.3/Couenne/src/expression/operators/exprGroup.cpp

    r223 r320  
    342342      x_occur -> first = w;
    343343    else {
    344       if ((w_occur -> second += x_occur -> second) == 0.) // add coefficients
     344                if ((w_occur -> second += x_occur -> second) == 0.) { // add coefficients
    345345        lcoeff_.erase (w_occur);                // if they cancel out, delete w as well
     346
     347        // under Microsoft, x_occur may have been invalidated by removing w_occur from lcoeff_, so we search for it again
     348        for( x_occur = lcoeff_.begin (); x_occur -> first -> Index () != xind; ++x_occur )
     349                assert(x_occur != lcoeff_ .end ()); // it was found before, so it should be still found
     350        }
    346351      lcoeff_.erase   (x_occur);                // delete entry of x
    347352    }
Note: See TracChangeset for help on using the changeset viewer.