assign_copy.pass.cpp 970 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. // <queue>
  9. // priority_queue& operator=(const priority_queue&) = default;
  10. #include <queue>
  11. #include <cassert>
  12. #include <functional>
  13. #include "test_macros.h"
  14. template <class C>
  15. C
  16. make(int n)
  17. {
  18. C c;
  19. for (int i = 0; i < n; ++i)
  20. c.push_back(i);
  21. return c;
  22. }
  23. int main(int, char**)
  24. {
  25. std::vector<int> v = make<std::vector<int> >(5);
  26. std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
  27. std::priority_queue<int, std::vector<int>, std::greater<int> > q;
  28. q = qo;
  29. assert(q.size() == 5);
  30. assert(q.top() == 0);
  31. return 0;
  32. }