libcxx

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

pop_back.pass.cpp (873B)


      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 pop_back();
     13 
     14 #include <vector>
     15 #include <cassert>
     16 
     17 #include "test_macros.h"
     18 #include "test_allocator.h"
     19 #include "min_allocator.h"
     20 
     21 
     22 int main()
     23 {
     24     {
     25         std::vector<int> c;
     26         c.push_back(1);
     27         assert(c.size() == 1);
     28         c.pop_back();
     29         assert(c.size() == 0);
     30 
     31     }
     32 #if TEST_STD_VER >= 11
     33     {
     34         std::vector<int, min_allocator<int>> c;
     35         c.push_back(1);
     36         assert(c.size() == 1);
     37         c.pop_back();
     38         assert(c.size() == 0);
     39     }
     40 #endif
     41 }