forked from OSchip/llvm-project
[llvm] Add contains(KeyType) -> bool methods to DenseSet
Matches C++20 API addition. Differential Revision: https://reviews.llvm.org/D83449
This commit is contained in:
parent
62d88a1c79
commit
d3ce3dc486
|
@ -173,6 +173,11 @@ public:
|
|||
return ConstIterator(TheMap.find(V));
|
||||
}
|
||||
|
||||
/// Check if the set contains the given element.
|
||||
bool contains(const_arg_type_t<ValueT> V) const {
|
||||
return TheMap.find(V) != TheMap.end();
|
||||
}
|
||||
|
||||
/// Alternative version of find() which allows a different, and possibly less
|
||||
/// expensive, key type.
|
||||
/// The DenseMapInfo is responsible for supplying methods
|
||||
|
|
|
@ -227,7 +227,7 @@ TEST(DenseSetCustomTest, ConstTest) {
|
|||
Map.insert(B);
|
||||
EXPECT_EQ(Map.count(B), 1u);
|
||||
EXPECT_EQ(Map.count(C), 1u);
|
||||
EXPECT_NE(Map.find(B), Map.end());
|
||||
EXPECT_NE(Map.find(C), Map.end());
|
||||
EXPECT_TRUE(Map.contains(B));
|
||||
EXPECT_TRUE(Map.contains(C));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue