volatile_pointer.pass.cpp 1012 B

12345678910111213141516171819202122232425262728293031
  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. // <iterator>
  9. // template<class T>
  10. // struct iterator_traits<const T*>
  11. #include <iterator>
  12. #include <type_traits>
  13. #include "test_macros.h"
  14. struct A {};
  15. int main(int, char**)
  16. {
  17. typedef std::iterator_traits<volatile A*> It;
  18. static_assert((std::is_same<It::difference_type, std::ptrdiff_t>::value), "");
  19. static_assert((std::is_same<It::value_type, A>::value), "");
  20. static_assert((std::is_same<It::pointer, volatile A*>::value), "");
  21. static_assert((std::is_same<It::reference, volatile A&>::value), "");
  22. static_assert((std::is_same<It::iterator_category, std::random_access_iterator_tag>::value), "");
  23. return 0;
  24. }