is_placeholder.pass.cpp 993 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <functional>
  10. // struct is_placeholder
  11. #include <functional>
  12. template <int Expected, class T>
  13. void
  14. test(const T&)
  15. {
  16. static_assert(std::is_placeholder<T>::value == Expected, "");
  17. }
  18. struct C {};
  19. int main()
  20. {
  21. test<1>(std::placeholders::_1);
  22. test<2>(std::placeholders::_2);
  23. test<3>(std::placeholders::_3);
  24. test<4>(std::placeholders::_4);
  25. test<5>(std::placeholders::_5);
  26. test<6>(std::placeholders::_6);
  27. test<7>(std::placeholders::_7);
  28. test<8>(std::placeholders::_8);
  29. test<9>(std::placeholders::_9);
  30. test<10>(std::placeholders::_10);
  31. test<0>(4);
  32. test<0>(5.5);
  33. test<0>('a');
  34. test<0>(C());
  35. }