More tests for LWG#2156
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@253257 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -33,6 +33,21 @@ void test(const C& c)
|
||||
assert(c.find(4)->second == "four");
|
||||
}
|
||||
|
||||
void reserve_invariant(size_t n) // LWG #2156
|
||||
{
|
||||
for (size_t i = 0; i < n; ++i)
|
||||
{
|
||||
std::unordered_multimap<size_t, size_t> c;
|
||||
c.reserve(n);
|
||||
size_t buckets = c.bucket_count();
|
||||
for (size_t j = 0; j < i; ++j)
|
||||
{
|
||||
c[i] = i;
|
||||
assert(buckets == c.bucket_count());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -90,4 +105,5 @@ int main()
|
||||
test(c);
|
||||
}
|
||||
#endif
|
||||
reserve_invariant(20);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user