uses_allocator.pass.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. // <tuple>
  9. // template <class... Types> class tuple;
  10. // template <class... Types, class Alloc>
  11. // struct uses_allocator<tuple<Types...>, Alloc> : true_type { };
  12. // UNSUPPORTED: c++98, c++03
  13. #include <tuple>
  14. #include <type_traits>
  15. #include "test_macros.h"
  16. struct A {};
  17. int main(int, char**)
  18. {
  19. {
  20. typedef std::tuple<> T;
  21. static_assert((std::is_base_of<std::true_type,
  22. std::uses_allocator<T, A>>::value), "");
  23. }
  24. {
  25. typedef std::tuple<int> T;
  26. static_assert((std::is_base_of<std::true_type,
  27. std::uses_allocator<T, A>>::value), "");
  28. }
  29. {
  30. typedef std::tuple<char, int> T;
  31. static_assert((std::is_base_of<std::true_type,
  32. std::uses_allocator<T, A>>::value), "");
  33. }
  34. {
  35. typedef std::tuple<double&, char, int> T;
  36. static_assert((std::is_base_of<std::true_type,
  37. std::uses_allocator<T, A>>::value), "");
  38. }
  39. return 0;
  40. }