   Resizing Problem
  This piece of code gives me an error 'iterator is outside of range' on the 'm_kSPositions.resize(iPEQuantity)' what sort of things can cause such a problem on resize? Is there a way in which I could use the debugger(MSVC90) to narrow down or find out the problem?Thanks.template <class Real>void TriangulateEC<Real>::InitializePositions (const Positions& rkPositions,    Query::Type eQueryType, Real fEpsilon, int iExtraElements){    int iPQuantity = (int)rkPositions.size();    assert(iPQuantity >= 3);    int iPEQuantity = iPQuantity + iExtraElements;    m_kSPositions.resize(iPEQuantity);    if (eQueryType == Query::QT_FILTERED)    {   assert((Real)0.0 <= fEpsilon && fEpsilon <= (Real)1.0);    }    Vector2<Real> kMin, kMax, kRange;    Real fScale, fRMax;    int i;
  If you place a breakpoint at the line in question then you can see what values you have in memory when you are calling the function.Is it possible that iExtraElements is negative?   ;  Oh I know how to use the call stack, place breakpoints and check values(Although that's about it) iExtraElements is 0, iPQuantity is 4.   ;  Have you tried stepping into the resize function?  Sure, Standard Library code can be pretty hard to read, but it should help you narrow down where in resize it's failing, which may help you know why it's failing.There are two possibilities that come to mind:1) iPEQuantity < m_kSPositions.size().  If this is true, then some of the objects stored in m_kSPositions will be destroyed.  Perhaps their destructors are causing the "iterator is outside of range" error.2)iPEQuantity > m_kSPositions.size().  If this is true, then new objects will have to be created.  Perhaps their constructors are causing the "iterator is outside of range" error.Anyway, stepping through the resize function should take you right to where it's failing.  Don't forget to keep stepping into things, and don't skip anything.  I assume that you'll eventually reach the constructor/destructor of the object that is causing the error and see what is wrong.  You should also check the constructors and destructors to make sure that they don't have any bugs you can see.  Of course this is me just speculating, but I believe there's a good chance that the error lies in the constructor and/or destructor.Mind you I don't know the type of m_kSPositions or what type of objects it contains...  I assume m_kSPositions is a vector (or something similar) and that it stores non-built-in types.   ;  It's also possible that you're experiencing the result of a buffer overflow or similar error somewhere else that's trashing the state of your vector sometime before resize() gets called.   