swap_noexcept.pass.cpp 892 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. // <queue>
  9. // void swap(priority_queue& c)
  10. // noexcept(__is_nothrow_swappable<container_type>::value &&
  11. // __is_nothrow_swappable<Compare>::value);
  12. // This tests a conforming extension
  13. // UNSUPPORTED: c++98, c++03
  14. #include <queue>
  15. #include <utility>
  16. #include <cassert>
  17. #include "test_macros.h"
  18. #include "MoveOnly.h"
  19. int main(int, char**)
  20. {
  21. {
  22. typedef std::priority_queue<MoveOnly> C;
  23. static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
  24. }
  25. return 0;
  26. }