Home | History | Annotate | Download | only in vector.modifiers
      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 // <vector>
     11 
     12 // void clear();
     13 
     14 #include <vector>
     15 #include <cassert>
     16 
     17 #include "min_allocator.h"
     18 #include "asan_testing.h"
     19 
     20 int main()
     21 {
     22     {
     23     int a[] = {1, 2, 3};
     24     std::vector<int> c(a, a+3);
     25     c.clear();
     26     assert(c.empty());
     27     LIBCPP_ASSERT(c.__invariants());
     28     LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
     29     }
     30 #if TEST_STD_VER >= 11
     31     {
     32     int a[] = {1, 2, 3};
     33     std::vector<int, min_allocator<int>> c(a, a+3);
     34     c.clear();
     35     assert(c.empty());
     36     LIBCPP_ASSERT(c.__invariants());
     37     LIBCPP_ASSERT(is_contiguous_container_asan_correct(c));
     38     }
     39 #endif
     40 }
     41