更新时间:2023-11-24 20:57:16
Use my_map.count( key );它只能返回0或1,本质上就是你想要的布尔结果.
my_map.count( key )
Use my_map.count( key ); it can only return 0 or 1, which is essentially the Boolean result you want.
或者 my_map.find( key ) != my_map.end() 也可以.
my_map.find( key ) != my_map.end()
如何在没有循环的情况下检查一个列表是否包含在另一个列表中?
如何在不进行插入的情况下检查 std::map 是否包含键?
如何在不使用字符串的情况下确定输入的整数是否包含某些数字
如何在没有循环的情况下检查特定数据列是否包含给定值