libcxx

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

emplace.pass.cpp (808B)


      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();
     15 
     16 // template <class... Args> void emplace(Args&&... args);
     17 
     18 #include <queue>
     19 #include <cassert>
     20 
     21 #include "../../../Emplaceable.h"
     22 
     23 int main()
     24 {
     25     std::priority_queue<Emplaceable> q;
     26     q.emplace(1, 2.5);
     27     assert(q.top() == Emplaceable(1, 2.5));
     28     q.emplace(3, 4.5);
     29     assert(q.top() == Emplaceable(3, 4.5));
     30     q.emplace(2, 3.5);
     31     assert(q.top() == Emplaceable(3, 4.5));
     32 }