contiguous.pass.cpp 805 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. // <array>
  9. // An array is a contiguous container
  10. #include <array>
  11. #include <cassert>
  12. #include "test_macros.h"
  13. template <class C>
  14. void test_contiguous ( const C &c )
  15. {
  16. for ( size_t i = 0; i < c.size(); ++i )
  17. assert ( *(c.begin() + i) == *(std::addressof(*c.begin()) + i));
  18. }
  19. int main(int, char**)
  20. {
  21. {
  22. typedef double T;
  23. typedef std::array<T, 3> C;
  24. test_contiguous (C());
  25. }
  26. return 0;
  27. }