uses_allocator.pass.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. struct A {};
  16. int main(int, char**)
  17. {
  18. {
  19. typedef std::tuple<> T;
  20. static_assert((std::is_base_of<std::true_type,
  21. std::uses_allocator<T, A>>::value), "");
  22. }
  23. {
  24. typedef std::tuple<int> T;
  25. static_assert((std::is_base_of<std::true_type,
  26. std::uses_allocator<T, A>>::value), "");
  27. }
  28. {
  29. typedef std::tuple<char, int> T;
  30. static_assert((std::is_base_of<std::true_type,
  31. std::uses_allocator<T, A>>::value), "");
  32. }
  33. {
  34. typedef std::tuple<double&, char, int> T;
  35. static_assert((std::is_base_of<std::true_type,
  36. std::uses_allocator<T, A>>::value), "");
  37. }
  38. return 0;
  39. }