Fix warnings in unordered_map

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242634 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier 2015-07-19 03:16:47 +00:00
parent 6af41ab8c2
commit fd9bbf52cd
29 changed files with 44 additions and 85 deletions

View File

@ -579,6 +579,11 @@ class Configuration(object):
self.cxx.addCompileFlagIfSupported('-Wno-pessimizing-move') self.cxx.addCompileFlagIfSupported('-Wno-pessimizing-move')
self.cxx.addCompileFlagIfSupported('-Wno-c++11-extensions') self.cxx.addCompileFlagIfSupported('-Wno-c++11-extensions')
self.cxx.addCompileFlagIfSupported('-Wno-user-defined-literals') self.cxx.addCompileFlagIfSupported('-Wno-user-defined-literals')
std = self.get_lit_conf('std', None)
if std in ['c++98', 'c++03']:
# The '#define static_assert' provided by libc++ in C++03 mode
# causes an unused local typedef whenever it is used.
self.cxx.addCompileFlagIfSupported('-Wno-unused-local-typedef')
def configure_sanitizer(self): def configure_sanitizer(self):
san = self.get_lit_conf('use_sanitizer', '').strip() san = self.get_lit_conf('use_sanitizer', '').strip()

View File

@ -19,20 +19,18 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
int main() int main()
{ {
{ {
typedef std::unordered_map<int, std::string> C; typedef std::unordered_map<int, std::string> C;
typedef C::const_iterator I;
typedef std::pair<int, std::string> P;
const C c; const C c;
assert(c.bucket_count() == 0); assert(c.bucket_count() == 0);
} }
{ {
typedef std::unordered_map<int, std::string> C; typedef std::unordered_map<int, std::string> C;
typedef C::const_iterator I;
typedef std::pair<int, std::string> P; typedef std::pair<int, std::string> P;
P a[] = P a[] =
{ {
@ -48,19 +46,16 @@ int main()
const C c(std::begin(a), std::end(a)); const C c(std::begin(a), std::end(a));
assert(c.bucket_count() >= 11); assert(c.bucket_count() >= 11);
} }
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
typedef C::const_iterator I;
typedef std::pair<int, std::string> P;
const C c; const C c;
assert(c.bucket_count() == 0); assert(c.bucket_count() == 0);
} }
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
typedef C::const_iterator I;
typedef std::pair<int, std::string> P; typedef std::pair<int, std::string> P;
P a[] = P a[] =
{ {

View File

@ -17,6 +17,7 @@
// http://llvm.org/bugs/show_bug.cgi?id=16549 // http://llvm.org/bugs/show_bug.cgi?id=16549
#include <unordered_map> #include <unordered_map>
#include <cassert>
struct Key { struct Key {
template <typename T> Key(const T&) {} template <typename T> Key(const T&) {}
@ -35,8 +36,12 @@ namespace std
int int
main() main()
{ {
std::unordered_map<Key, int>::iterator it = typedef std::unordered_map<Key, int> MapT;
std::unordered_map<Key, int>().find(Key(0)); typedef MapT::iterator Iter;
std::pair<std::unordered_map<Key, int>::iterator, bool> result = MapT map;
std::unordered_map<Key, int>().insert(std::make_pair(Key(0), 0)); Iter it = map.find(Key(0));
assert(it == map.end());
std::pair<Iter, bool> result = map.insert(std::make_pair(Key(0), 42));
assert(result.second);
assert(result.first->second == 42);
} }

View File

@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <cfloat> #include <cfloat>
#include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
int main() int main()
@ -43,11 +44,10 @@ int main()
} }
{ {
typedef std::unordered_map<int, std::string> C; typedef std::unordered_map<int, std::string> C;
typedef std::pair<int, std::string> P;
const C c; const C c;
assert(c.load_factor() == 0); assert(c.load_factor() == 0);
} }
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
@ -69,7 +69,6 @@ int main()
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
typedef std::pair<int, std::string> P;
const C c; const C c;
assert(c.load_factor() == 0); assert(c.load_factor() == 0);
} }

View File

@ -19,23 +19,20 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
int main() int main()
{ {
{ {
typedef std::unordered_map<int, std::string> C; typedef std::unordered_map<int, std::string> C;
typedef C::const_iterator I;
typedef std::pair<int, std::string> P;
const C c; const C c;
assert(c.max_bucket_count() > 0); assert(c.max_bucket_count() > 0);
} }
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
typedef C::const_iterator I;
typedef std::pair<int, std::string> P;
const C c; const C c;
assert(c.max_bucket_count() > 0); assert(c.max_bucket_count() > 0);
} }

View File

@ -16,44 +16,37 @@
// float max_load_factor() const; // float max_load_factor() const;
// void max_load_factor(float mlf); // void max_load_factor(float mlf);
#ifdef _LIBCPP_DEBUG
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#endif
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
#include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
int main() int main()
{ {
{ {
typedef std::unordered_map<int, std::string> C; typedef std::unordered_map<int, std::string> C;
typedef std::pair<int, std::string> P;
const C c; const C c;
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
{ {
typedef std::unordered_map<int, std::string> C; typedef std::unordered_map<int, std::string> C;
typedef std::pair<int, std::string> P;
C c; C c;
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
c.max_load_factor(2.5); c.max_load_factor(2.5);
assert(c.max_load_factor() == 2.5); assert(c.max_load_factor() == 2.5);
} }
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
typedef std::pair<int, std::string> P;
const C c; const C c;
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
} }
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
typedef std::pair<int, std::string> P;
C c; C c;
assert(c.max_load_factor() == 1); assert(c.max_load_factor() == 1);
c.max_load_factor(2.5); c.max_load_factor(2.5);

View File

@ -21,6 +21,7 @@
#include "../../test_compare.h" #include "../../test_compare.h"
#include "../../test_hash.h" #include "../../test_hash.h"
#include "test_macros.h"
#include "test_allocator.h" #include "test_allocator.h"
#include "min_allocator.h" #include "min_allocator.h"
@ -31,7 +32,6 @@ int main()
typedef test_compare<std::equal_to<int> > Compare; typedef test_compare<std::equal_to<int> > Compare;
typedef test_allocator<std::pair<const int, std::string> > Alloc; typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C; typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1)); C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2)); C c2(0, Hash(2), Compare(2), Alloc(2));
c2.max_load_factor(2); c2.max_load_factor(2);
@ -212,7 +212,6 @@ int main()
typedef test_compare<std::equal_to<int> > Compare; typedef test_compare<std::equal_to<int> > Compare;
typedef other_allocator<std::pair<const int, std::string> > Alloc; typedef other_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C; typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1)); C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2)); C c2(0, Hash(2), Compare(2), Alloc(2));
c2.max_load_factor(2); c2.max_load_factor(2);
@ -387,13 +386,12 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
{ {
typedef test_hash<std::hash<int> > Hash; typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare; typedef test_compare<std::equal_to<int> > Compare;
typedef min_allocator<std::pair<const int, std::string> > Alloc; typedef min_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C; typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc()); C c1(0, Hash(1), Compare(1), Alloc());
C c2(0, Hash(2), Compare(2), Alloc()); C c2(0, Hash(2), Compare(2), Alloc());
c2.max_load_factor(2); c2.max_load_factor(2);

View File

@ -15,6 +15,8 @@
// unordered_map(unordered_map&& u); // unordered_map(unordered_map&& u);
// UNSUPPORTED: c++98, c++03
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <cassert> #include <cassert>
@ -27,23 +29,12 @@
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
typedef std::unordered_map<int, std::string, typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >, test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >, test_compare<std::equal_to<int> >,
test_allocator<std::pair<const int, std::string> > test_allocator<std::pair<const int, std::string> >
> C; > C;
typedef std::pair<int, std::string> P;
P a[] =
{
P(1, "one"),
P(2, "two"),
P(3, "three"),
P(4, "four"),
P(1, "four"),
P(2, "four"),
};
C c0(7, C c0(7,
test_hash<std::hash<int> >(8), test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9), test_compare<std::equal_to<int> >(9),
@ -105,23 +96,12 @@ int main()
assert(c0.empty()); assert(c0.empty());
} }
#if __cplusplus >= 201103L
{ {
typedef std::unordered_map<int, std::string, typedef std::unordered_map<int, std::string,
test_hash<std::hash<int> >, test_hash<std::hash<int> >,
test_compare<std::equal_to<int> >, test_compare<std::equal_to<int> >,
min_allocator<std::pair<const int, std::string> > min_allocator<std::pair<const int, std::string> >
> C; > C;
typedef std::pair<int, std::string> P;
P a[] =
{
P(1, "one"),
P(2, "two"),
P(3, "three"),
P(4, "four"),
P(1, "four"),
P(2, "four"),
};
C c0(7, C c0(7,
test_hash<std::hash<int> >(8), test_hash<std::hash<int> >(8),
test_compare<std::equal_to<int> >(9), test_compare<std::equal_to<int> >(9),
@ -183,7 +163,6 @@ int main()
assert(c0.empty()); assert(c0.empty());
} }
#endif
#if _LIBCPP_DEBUG >= 1 #if _LIBCPP_DEBUG >= 1
{ {
std::unordered_map<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}}; std::unordered_map<int, int> s1 = {{1, 1}, {2, 2}, {3, 3}};
@ -195,5 +174,4 @@ int main()
assert(s2.size() == 2); assert(s2.size() == 2);
} }
#endif #endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@ -19,6 +19,7 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
struct TemplateConstructor struct TemplateConstructor
@ -46,13 +47,13 @@ int main()
}; };
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2); C::const_iterator i = c.find(2);
C::iterator j = c.erase(i); c.erase(i);
assert(c.size() == 3); assert(c.size() == 3);
assert(c.at(1) == "one"); assert(c.at(1) == "one");
assert(c.at(3) == "three"); assert(c.at(3) == "three");
assert(c.at(4) == "four"); assert(c.at(4) == "four");
} }
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
@ -68,14 +69,14 @@ int main()
}; };
C c(a, a + sizeof(a)/sizeof(a[0])); C c(a, a + sizeof(a)/sizeof(a[0]));
C::const_iterator i = c.find(2); C::const_iterator i = c.find(2);
C::iterator j = c.erase(i); c.erase(i);
assert(c.size() == 3); assert(c.size() == 3);
assert(c.at(1) == "one"); assert(c.at(1) == "one");
assert(c.at(3) == "three"); assert(c.at(3) == "three");
assert(c.at(4) == "four"); assert(c.at(4) == "four");
} }
#endif #endif
#if __cplusplus >= 201402L #if TEST_STD_VER >= 14
{ {
// This is LWG #2059 // This is LWG #2059
typedef TemplateConstructor T; typedef TemplateConstructor T;

View File

@ -19,15 +19,16 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include "test_macros.h"
#include "min_allocator.h" #include "min_allocator.h"
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
template <typename Unordered> template <typename Unordered>
bool only_deletions ( const Unordered &whole, const Unordered &part ) { bool only_deletions ( const Unordered &whole, const Unordered &part ) {
typename Unordered::const_iterator w = whole.begin(); typename Unordered::const_iterator w = whole.begin();
typename Unordered::const_iterator p = part.begin(); typename Unordered::const_iterator p = part.begin();
while ( w != whole.end () && p != part.end()) { while ( w != whole.end () && p != part.end()) {
if ( *w == *p ) if ( *w == *p )
p++; p++;
w++; w++;
@ -96,7 +97,7 @@ int main()
assert(c.erase(3) == 0); assert(c.erase(3) == 0);
assert(c.size() == 0); assert(c.size() == 0);
} }
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
{ {
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
min_allocator<std::pair<const int, std::string>>> C; min_allocator<std::pair<const int, std::string>>> C;
@ -161,7 +162,7 @@ int main()
m[i] = i; m[i] = i;
m2[i] = i; m2[i] = i;
} }
C::iterator i = m2.begin(); C::iterator i = m2.begin();
int ctr = 0; int ctr = 0;
while (i != m2.end()) { while (i != m2.end()) {

View File

@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: c++03, c++11, c++14 // UNSUPPORTED: c++98, c++03, c++11, c++14
// <unordered_map> // <unordered_map>
@ -22,12 +22,10 @@
// template <class M> // template <class M>
// iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 // iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17
#include <__config>
#include <unordered_map> #include <unordered_map>
#include <cassert> #include <cassert>
#include <tuple> #include <tuple>
#include <iostream>
class Moveable class Moveable
{ {
@ -53,7 +51,7 @@ public:
bool operator<(const Moveable& x) const bool operator<(const Moveable& x) const
{return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);} {return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);}
size_t hash () const { return std::hash<int>()(int_) + std::hash<double>()(double_); } size_t hash () const { return std::hash<int>()(int_) + std::hash<double>()(double_); }
int get() const {return int_;} int get() const {return int_;}
bool moved() const {return int_ == -1;} bool moved() const {return int_ == -1;}
}; };
@ -66,8 +64,6 @@ namespace std {
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
{ // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); { // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
typedef std::unordered_map<int, Moveable> M; typedef std::unordered_map<int, Moveable> M;
@ -193,6 +189,4 @@ int main()
assert(r->second.get() == 5); // value assert(r->second.get() == 5); // value
} }
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@ -7,7 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// UNSUPPORTED: c++03, c++11, c++14 // UNSUPPORTED: c++98, c++03, c++11, c++14
// <unordered_map> // <unordered_map>
@ -64,8 +64,6 @@ namespace std {
int main() int main()
{ {
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
{ // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); { // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
typedef std::unordered_map<int, Moveable> M; typedef std::unordered_map<int, Moveable> M;
@ -110,7 +108,7 @@ int main()
assert(r.first->second.get() == -1); // value assert(r.first->second.get() == -1); // value
} }
{ // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args); { // pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
typedef std::unordered_map<Moveable, Moveable> M; typedef std::unordered_map<Moveable, Moveable> M;
typedef std::pair<M::iterator, bool> R; typedef std::pair<M::iterator, bool> R;
M m; M m;
@ -146,7 +144,7 @@ int main()
m.try_emplace ( i, Moveable(i, (double) i)); m.try_emplace ( i, Moveable(i, (double) i));
assert(m.size() == 10); assert(m.size() == 10);
M::const_iterator it = m.find(2); M::const_iterator it = m.find(2);
Moveable mv1(3, 3.0); Moveable mv1(3, 3.0);
for (int i=0; i < 20; i += 2) for (int i=0; i < 20; i += 2)
{ {
@ -189,7 +187,4 @@ int main()
assert(r->first.get() == 3); // key assert(r->first.get() == 3); // key
assert(r->second.get() == 4); // value assert(r->second.get() == 4); // value
} }
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
} }

View File

@ -21,6 +21,7 @@
#include "../../../test_compare.h" #include "../../../test_compare.h"
#include "../../../test_hash.h" #include "../../../test_hash.h"
#include "test_macros.h"
#include "test_allocator.h" #include "test_allocator.h"
#include "min_allocator.h" #include "min_allocator.h"
@ -31,7 +32,6 @@ int main()
typedef test_compare<std::equal_to<int> > Compare; typedef test_compare<std::equal_to<int> > Compare;
typedef test_allocator<std::pair<const int, std::string> > Alloc; typedef test_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C; typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1)); C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2)); C c2(0, Hash(2), Compare(2), Alloc(2));
c2.max_load_factor(2); c2.max_load_factor(2);
@ -212,7 +212,6 @@ int main()
typedef test_compare<std::equal_to<int> > Compare; typedef test_compare<std::equal_to<int> > Compare;
typedef other_allocator<std::pair<const int, std::string> > Alloc; typedef other_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C; typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc(1)); C c1(0, Hash(1), Compare(1), Alloc(1));
C c2(0, Hash(2), Compare(2), Alloc(2)); C c2(0, Hash(2), Compare(2), Alloc(2));
c2.max_load_factor(2); c2.max_load_factor(2);
@ -387,13 +386,12 @@ int main()
assert(std::distance(c2.cbegin(), c2.cend()) == c2.size()); assert(std::distance(c2.cbegin(), c2.cend()) == c2.size());
assert(c2.max_load_factor() == 1); assert(c2.max_load_factor() == 1);
} }
#if __cplusplus >= 201103L #if TEST_STD_VER >= 11
{ {
typedef test_hash<std::hash<int> > Hash; typedef test_hash<std::hash<int> > Hash;
typedef test_compare<std::equal_to<int> > Compare; typedef test_compare<std::equal_to<int> > Compare;
typedef min_allocator<std::pair<const int, std::string> > Alloc; typedef min_allocator<std::pair<const int, std::string> > Alloc;
typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C; typedef std::unordered_map<int, std::string, Hash, Compare, Alloc> C;
typedef std::pair<int, std::string> P;
C c1(0, Hash(1), Compare(1), Alloc()); C c1(0, Hash(1), Compare(1), Alloc());
C c2(0, Hash(2), Compare(2), Alloc()); C c2(0, Hash(2), Compare(2), Alloc());
c2.max_load_factor(2); c2.max_load_factor(2);