unary_function.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #ifndef _LIBCPP___FUNCTIONAL_UNARY_FUNCTION_H
  9. #define _LIBCPP___FUNCTIONAL_UNARY_FUNCTION_H
  10. #include <__config>
  11. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  12. # pragma GCC system_header
  13. #endif
  14. _LIBCPP_BEGIN_NAMESPACE_STD
  15. #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
  16. template <class _Arg, class _Result>
  17. struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 unary_function
  18. {
  19. typedef _Arg argument_type;
  20. typedef _Result result_type;
  21. };
  22. #endif // _LIBCPP_STD_VER <= 14
  23. template <class _Arg, class _Result> struct __unary_function_keep_layout_base {
  24. #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
  25. using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg;
  26. using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result;
  27. #endif
  28. };
  29. #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
  30. _LIBCPP_DIAGNOSTIC_PUSH
  31. _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
  32. template <class _Arg, class _Result>
  33. using __unary_function = unary_function<_Arg, _Result>;
  34. _LIBCPP_DIAGNOSTIC_POP
  35. #else
  36. template <class _Arg, class _Result>
  37. using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
  38. #endif
  39. _LIBCPP_END_NAMESPACE_STD
  40. #endif // _LIBCPP___FUNCTIONAL_UNARY_FUNCTION_H