push_rvalue.pass.cpp 749 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. // void push(value_type&& v);
  12. #include <queue>
  13. #include <cassert>
  14. #include "test_macros.h"
  15. #include "MoveOnly.h"
  16. int main(int, char**)
  17. {
  18. std::priority_queue<MoveOnly> q;
  19. q.push(1);
  20. assert(q.top() == 1);
  21. q.push(3);
  22. assert(q.top() == 3);
  23. q.push(2);
  24. assert(q.top() == 3);
  25. return 0;
  26. }