`out_of_range' has not been declared
如下代码,在VS2010下运行正常,但是,在CFree(mingw5)运行就会出现 `out_of_range' has not been declared的问题,请问下,这是什么原因呢?要如何做才能正常运行?
#include <iostream>#include <string> using namespace std; int main() { string s="what is your name?"; int index, len; while(true) { cout<<"Enter index and len to erase: "; cin>>index>>len; try { s.erase(index,len); } catch(out_of_range) { cout<<"out of range!!!"; continue; } break; } return 0; }
#include <stdexcept>