且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查元素是否在 std::set 中?

更新时间:2023-11-25 21:51:52

在许多 STL 容器(例如 std::mapstd::set, ... 是:

The typical way to check for existence in many STL containers such as std::map, std::set, ... is:

const bool is_in = container.find(element) != container.end();