Skip to content

Commit 4525c5d

Browse files
committed
Apply suggestion by @Skylion007, with additional trivial simplification.
1 parent 3a3b9f2 commit 4525c5d

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

include/pybind11/stl_bind.h

+1-7
Original file line numberDiff line numberDiff line change
@@ -667,13 +667,7 @@ struct KeysViewImpl : public KeysView {
667667
explicit KeysViewImpl(Map &map) : map(map) {}
668668
size_t len() override { return map.size(); }
669669
iterator iter() override { return make_key_iterator(map.begin(), map.end()); }
670-
bool contains(const typename Map::key_type &k) override {
671-
auto it = map.find(k);
672-
if (it == map.end()) {
673-
return false;
674-
}
675-
return true;
676-
}
670+
bool contains(const typename Map::key_type &k) override { return map.find(k) != map.end(); }
677671
bool contains(const object &) override { return false; }
678672
Map ↦
679673
};

0 commit comments

Comments
 (0)