2010-05-11 21:42:16 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2010-05-11 23:36:01 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-05-11 21:42:16 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// <unordered_set>
|
|
|
|
|
|
|
|
// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
|
|
|
|
// class Alloc = allocator<Value>>
|
|
|
|
// class unordered_set
|
|
|
|
|
|
|
|
// float load_factor() const
|
|
|
|
|
|
|
|
#include <unordered_set>
|
|
|
|
#include <cassert>
|
2011-12-02 22:23:14 +01:00
|
|
|
#include <cfloat>
|
2010-05-11 21:42:16 +02:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
typedef std::unordered_set<int> C;
|
|
|
|
typedef int P;
|
|
|
|
P a[] =
|
|
|
|
{
|
|
|
|
P(10),
|
|
|
|
P(20),
|
|
|
|
P(30),
|
|
|
|
P(40),
|
|
|
|
P(50),
|
|
|
|
P(60),
|
|
|
|
P(70),
|
|
|
|
P(80)
|
|
|
|
};
|
|
|
|
const C c(std::begin(a), std::end(a));
|
2011-12-02 22:23:14 +01:00
|
|
|
assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON);
|
2010-05-11 21:42:16 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
typedef std::unordered_set<int> C;
|
|
|
|
typedef int P;
|
|
|
|
const C c;
|
|
|
|
assert(c.load_factor() == 0);
|
|
|
|
}
|
|
|
|
}
|