libcxx

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

assign_move.pass.cpp (871B)


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