1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <unordered_map> 11 12 // class unordered_map 13 14 // bool empty() const noexcept; 15 16 #include <unordered_map> 17 #include <cassert> 18 19 #include "test_macros.h" 20 #include "min_allocator.h" 21 main()22int main() 23 { 24 { 25 typedef std::unordered_map<int, double> M; 26 M m; 27 ASSERT_NOEXCEPT(m.empty()); 28 assert(m.empty()); 29 m.insert(M::value_type(1, 1.5)); 30 assert(!m.empty()); 31 m.clear(); 32 assert(m.empty()); 33 } 34 #if TEST_STD_VER >= 11 35 { 36 typedef std::unordered_map<int, double, std::hash<int>, std::equal_to<int>, min_allocator<std::pair<const int, double>>> M; 37 M m; 38 ASSERT_NOEXCEPT(m.empty()); 39 assert(m.empty()); 40 m.insert(M::value_type(1, 1.5)); 41 assert(!m.empty()); 42 m.clear(); 43 assert(m.empty()); 44 } 45 #endif 46 } 47