From 4525c5d1363631c782e84111af9ff588096292fb Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 8 Dec 2022 22:41:37 -0800 Subject: [PATCH] Apply suggestion by @Skylion007, with additional trivial simplification. --- include/pybind11/stl_bind.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/pybind11/stl_bind.h b/include/pybind11/stl_bind.h index f520651191..0c634597ec 100644 --- a/include/pybind11/stl_bind.h +++ b/include/pybind11/stl_bind.h @@ -667,13 +667,7 @@ struct KeysViewImpl : public KeysView { explicit KeysViewImpl(Map &map) : map(map) {} size_t len() override { return map.size(); } iterator iter() override { return make_key_iterator(map.begin(), map.end()); } - bool contains(const typename Map::key_type &k) override { - auto it = map.find(k); - if (it == map.end()) { - return false; - } - return true; - } + bool contains(const typename Map::key_type &k) override { return map.find(k) != map.end(); } bool contains(const object &) override { return false; } Map ↦ };