👽原因
原因在于使用string(iter1, iter2)这个构造函数时,iter1>iter2。
即: 字符串构造失败。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| #include <string> #include <iostream> #include <algorithm> using namespace std;
int main() { try{ string s("abc"); string::const_iterator ie = s.cbegin() + 1, ia = s.cbegin() ; string as = string(ie, ia); }catch(exception& e) { cout << e.what() << endl; } return 0; }
|
👺由来(废话 )
最近在挂服务器的时候经常遇见一个莫名的崩溃原因:basic_string::Mcreate。不管是百度还是google总是找不到相关的问题,在stackflow上也没能找到合理的答案,stackflow上唯一一个相关问题是与mysql相关的,因为我也使用了mysql的接口,让我不禁觉得这个问题来自于mysql的插件,最后我发现问题在于我自己写的Http解析组件。

