libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

clear.pass.cpp (823B)


      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 // <list>
     11 
     12 // void clear() noexcept;
     13 
     14 #include <list>
     15 #include <cassert>
     16 
     17 #include "test_macros.h"
     18 #include "min_allocator.h"
     19 
     20 int main()
     21 {
     22     {
     23     int a[] = {1, 2, 3};
     24     std::list<int> c(a, a+3);
     25     ASSERT_NOEXCEPT(c.clear());
     26     c.clear();
     27     assert(c.empty());
     28     }
     29 #if TEST_STD_VER >= 11
     30     {
     31     int a[] = {1, 2, 3};
     32     std::list<int, min_allocator<int>> c(a, a+3);
     33     ASSERT_NOEXCEPT(c.clear());
     34     c.clear();
     35     assert(c.empty());
     36     }
     37 #endif
     38 }