tuple_size.pass.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. // tuple_size<array<T, N> >::value
  10. #include <array>
  11. #include "test_macros.h"
  12. template <class T, std::size_t N>
  13. void test()
  14. {
  15. {
  16. typedef std::array<T, N> C;
  17. static_assert((std::tuple_size<C>::value == N), "");
  18. }
  19. {
  20. typedef std::array<T const, N> C;
  21. static_assert((std::tuple_size<C>::value == N), "");
  22. }
  23. {
  24. typedef std::array<T volatile, N> C;
  25. static_assert((std::tuple_size<C>::value == N), "");
  26. }
  27. {
  28. typedef std::array<T const volatile, N> C;
  29. static_assert((std::tuple_size<C>::value == N), "");
  30. }
  31. }
  32. int main(int, char**)
  33. {
  34. test<double, 0>();
  35. test<double, 3>();
  36. test<double, 5>();
  37. return 0;
  38. }