运行 ❯
获取您
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <iostream> #include <map> using namespace std; int main() { map<string, int> people = { {"John", 32}, {"Adele", 45}, {"Bo", 29} }; // Remove an element by key people.erase("John"); // This will throw an error as John no longer exists cout << "John is: " << people.at("John") << "\n"; return 0; }
抛出 'std::out_of_range' 异常后终止
what(): map::at