swap_noexcept.pass.cpp 806 B

1234567891011121314151617181920212223242526272829303132
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <queue>
  10. // void swap(priority_queue& c)
  11. // noexcept(__is_nothrow_swappable<container_type>::value &&
  12. // __is_nothrow_swappable<Compare>::value);
  13. // This tests a conforming extension
  14. #include <queue>
  15. #include <cassert>
  16. #include "MoveOnly.h"
  17. int main()
  18. {
  19. #if __has_feature(cxx_noexcept)
  20. {
  21. typedef std::priority_queue<MoveOnly> C;
  22. C c1, c2;
  23. static_assert(noexcept(swap(c1, c2)), "");
  24. }
  25. #endif
  26. }