Home | History | Annotate | Download | only in unord.set
      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 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
     13 //           class Alloc = allocator<Value>>
     14 // class unordered_set
     15 
     16 // void clear()
     17 
     18 #include <unordered_set>
     19 #include <cassert>
     20 
     21 #include "min_allocator.h"
     22 
     23 int main()
     24 {
     25     {
     26         typedef std::unordered_set<int> C;
     27         typedef int P;
     28         P a[] =
     29         {
     30             P(1),
     31             P(2),
     32             P(3),
     33             P(4),
     34             P(1),
     35             P(2)
     36         };
     37         C c(a, a + sizeof(a)/sizeof(a[0]));
     38         c.clear();
     39         assert(c.size() == 0);
     40     }
     41 #if TEST_STD_VER >= 11
     42     {
     43         typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
     44         typedef int P;
     45         P a[] =
     46         {
     47             P(1),
     48             P(2),
     49             P(3),
     50             P(4),
     51             P(1),
     52             P(2)
     53         };
     54         C c(a, a + sizeof(a)/sizeof(a[0]));
     55         c.clear();
     56         assert(c.size() == 0);
     57     }
     58 #endif
     59 }
     60