pointer.pass.cpp 841 B

1234567891011121314151617181920212223242526272829303132333435
  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 Ptr>
  10. // struct pointer_traits
  11. // {
  12. // typedef Ptr pointer;
  13. // ...
  14. // };
  15. #include <memory>
  16. #include <type_traits>
  17. #include "test_macros.h"
  18. struct A
  19. {
  20. typedef short element_type;
  21. typedef char difference_type;
  22. };
  23. int main(int, char**)
  24. {
  25. static_assert((std::is_same<std::pointer_traits<A>::pointer, A>::value), "");
  26. static_assert((std::is_same<std::pointer_traits<int*>::pointer, int*>::value), "");
  27. return 0;
  28. }