emplace.pass.cpp 870 B

12345678910111213141516171819202122232425262728293031323334
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // UNSUPPORTED: c++98, c++03
  9. // <queue>
  10. // priority_queue();
  11. // template <class... Args> void emplace(Args&&... args);
  12. #include <queue>
  13. #include <cassert>
  14. #include "test_macros.h"
  15. #include "../../../Emplaceable.h"
  16. int main(int, char**)
  17. {
  18. std::priority_queue<Emplaceable> q;
  19. q.emplace(1, 2.5);
  20. assert(q.top() == Emplaceable(1, 2.5));
  21. q.emplace(3, 4.5);
  22. assert(q.top() == Emplaceable(3, 4.5));
  23. q.emplace(2, 3.5);
  24. assert(q.top() == Emplaceable(3, 4.5));
  25. return 0;
  26. }