关于[]运算:
当利用[]运算符取unordered_map中的值时,如果[]中的元素不存在,那么返回0;如下:
@Override
unordered_map<char, int> t_win;
cout << "测试取下标返回值:" << t_win['k'] << endl;
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/61a59d06b0b766fec8479552787b3226.png)
unordered_map的[]运算符用法见leetcode这题:
https://leetcode-cn.com/problems/minimum-window-substring/solution/zui-xiao-fu-gai-zi-chuan-by-leetcode-solution/