libcxx

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

assign_copy.pass.cpp (907B)


      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 // <queue>
     11 
     12 // priority_queue& operator=(const priority_queue&) = default;
     13 
     14 #include <queue>
     15 #include <cassert>
     16 #include <functional>
     17 
     18 template <class C>
     19 C
     20 make(int n)
     21 {
     22     C c;
     23     for (int i = 0; i < n; ++i)
     24         c.push_back(i);
     25     return c;
     26 }
     27 
     28 int main()
     29 {
     30     std::vector<int> v = make<std::vector<int> >(5);
     31     std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
     32     std::priority_queue<int, std::vector<int>, std::greater<int> > q;
     33     q = qo;
     34     assert(q.size() == 5);
     35     assert(q.top() == 0);
     36 }