id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12893,Add debug check for boost::container::string::c_str method,Lev Sch ,Ion Gaztañaga,"If boost::container::string was destroyed then result of c_str method must be invalidated. It will help to catch errors in a application. Notes: 1. std::string on MS Visual Studio 2015 is already does this check. 2. some patterns are here http://stackoverflow.com/a/127404 Example: {{{ #include #include #include bool isAbcd(const char* ch) { if ( ch[0] == 'a' && ch[1] == 'b' && ch[2] == 'c' && ch[3] == 'd' && ch[4] == '\0' ) { return true; } return false; } void exampleNewDelete() { char* ch = new char[5]; ch[0] = 'a'; ch[1] = 'b'; ch[2] = 'c'; ch[3] = 'd'; ch[4] = '\0'; assert(isAbcd(ch)); delete[] ch; const bool ok = isAbcd(ch); // if app crash then test OK if ( ok ) { assert(false); // test failed } // test OK } void exampleStdString() { char* ch; ch = (char*)std::string(""abcd"").c_str(); const bool ok = isAbcd(ch); // if app crash then test OK if ( ok ) { assert(false); // test failed } // test OK } void exampleBoostString() { char* ch; ch = (char*)boost::container::string(""abcd"").c_str(); const bool ok = isAbcd(ch); // if app crash then test OK if ( ok ) { assert(false); // test failed } // test OK } int main() { //exampleNewDelete(); //exampleStdString(); //exampleBoostString(); return 0; } }}} ",Feature Requests,new,To Be Determined,container,Boost 1.63.0,Problem,,,