mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[ADT] Add DenseSetImpl(begin, end)
This commit is contained in:
parent
d0e265874f
commit
89be05da5c
@ -66,6 +66,12 @@ public:
|
||||
|
||||
explicit DenseSetImpl(unsigned InitialReserve = 0) : TheMap(InitialReserve) {}
|
||||
|
||||
template <typename InputIt>
|
||||
DenseSetImpl(const InputIt &I, const InputIt &E)
|
||||
: DenseSetImpl(PowerOf2Ceil(std::distance(I, E))) {
|
||||
insert(I, E);
|
||||
}
|
||||
|
||||
DenseSetImpl(std::initializer_list<ValueT> Elems)
|
||||
: DenseSetImpl(PowerOf2Ceil(Elems.size())) {
|
||||
insert(Elems.begin(), Elems.end());
|
||||
|
@ -70,6 +70,15 @@ typedef ::testing::Types<DenseSet<unsigned, TestDenseSetInfo>,
|
||||
DenseSetTestTypes;
|
||||
TYPED_TEST_CASE(DenseSetTest, DenseSetTestTypes);
|
||||
|
||||
TYPED_TEST(DenseSetTest, Constructor) {
|
||||
constexpr unsigned a[] = {1, 2, 4};
|
||||
TypeParam set(std::begin(a), std::end(a));
|
||||
EXPECT_EQ(3u, set.size());
|
||||
EXPECT_EQ(1u, set.count(1));
|
||||
EXPECT_EQ(1u, set.count(2));
|
||||
EXPECT_EQ(1u, set.count(4));
|
||||
}
|
||||
|
||||
TYPED_TEST(DenseSetTest, InitializerList) {
|
||||
TypeParam set({1, 2, 1, 4});
|
||||
EXPECT_EQ(3u, set.size());
|
||||
|
Loading…
x
Reference in New Issue
Block a user