push_rv.pass.cpp 976 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. // void push(value_type&& v);
  11. #include <queue>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. #include "MoveOnly.h"
  15. int main(int, char**)
  16. {
  17. std::queue<MoveOnly> q;
  18. q.push(MoveOnly(1));
  19. assert(q.size() == 1);
  20. assert(q.front() == MoveOnly(1));
  21. assert(q.back() == MoveOnly(1));
  22. q.push(MoveOnly(2));
  23. assert(q.size() == 2);
  24. assert(q.front() == MoveOnly(1));
  25. assert(q.back() == MoveOnly(2));
  26. q.push(MoveOnly(3));
  27. assert(q.size() == 3);
  28. assert(q.front() == MoveOnly(1));
  29. assert(q.back() == MoveOnly(3));
  30. return 0;
  31. }