Original Post
My code is simply this: However after the line labeled "BREAK" is executed, I get a user break in my application associated with the destruction of the vector and its string resource(s). Call stack excerpt included for your convenience right here (using wide-character strings, however doesn't work with regular strings either): I'm using the stock implementation of STL, but I'm also using MSVC 7.1 which supposedly has a pretty solid implementation. One thing I've noticed is that if I use copy construction for someVector instead of assignment, then the application doesn't break until the vector goes out of scope, but it still happens. And for the pedantic among you ([smile]), this code is only run once during initialization so ignore the abundant copies. It simply makes my life easier.
vector<string> CreateVector()
{
vector<string> theVector;
theVector.push_back("Arbitrary string");
return theVector;
}
// ... elsewhere ...
vector<string> someVector;
someVector = CreateVector(); // BREAK
> AppFrame.dll!_CrtIsValidHeapPointer(const void * pUserData=0x002f5df0) Line 1807 C
AppFrame.dll!_free_dbg_lk(void * pUserData=0x002f5df0, int nBlockUse=1) Line 1132 + 0x9 C
AppFrame.dll!_free_dbg(void * pUserData=0x002f5df0, int nBlockUse=1) Line 1070 + 0xd C
AppFrame.dll!operator delete(void * pUserData=0x002f5df0) Line 54 + 0x10 C++
AppFrame.dll!std::allocator<unsigned short>::deallocate(unsigned short * _Ptr=0x002f5df0, unsigned int __formal=24) Line 132 + 0x9 C++