rebind.pass.cpp 848 B

1234567891011121314151617181920212223242526272829303132
  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. // <memory>
  9. // template <class T>
  10. // struct pointer_traits<T*>
  11. // {
  12. // template <class U> using rebind = U*;
  13. // ...
  14. // };
  15. #include <memory>
  16. #include <type_traits>
  17. #include "test_macros.h"
  18. int main(int, char**)
  19. {
  20. #if TEST_STD_VER >= 11
  21. static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), "");
  22. #else
  23. static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), "");
  24. #endif
  25. return 0;
  26. }