• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_set>
11 
12 // class unordered_set
13 
14 // bool empty() const noexcept;
15 
16 #include <unordered_set>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 #include "min_allocator.h"
21 
main()22 int main()
23 {
24     {
25     typedef std::unordered_set<int> M;
26     M m;
27     ASSERT_NOEXCEPT(m.empty());
28     assert(m.empty());
29     m.insert(M::value_type(1));
30     assert(!m.empty());
31     m.clear();
32     assert(m.empty());
33     }
34 #if TEST_STD_VER >= 11
35     {
36     typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> M;
37     M m;
38     ASSERT_NOEXCEPT(m.empty());
39     assert(m.empty());
40     m.insert(M::value_type(1));
41     assert(!m.empty());
42     m.clear();
43     assert(m.empty());
44     }
45 #endif
46 }
47