| 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 | |
| 9 | #ifndef _LIBCPP___FUNCTIONAL_UNARY_FUNCTION_H |
| 10 | #define _LIBCPP___FUNCTIONAL_UNARY_FUNCTION_H |
| 11 | |
| 12 | #include <__config> |
| 13 | |
| 14 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 15 | # pragma GCC system_header |
| 16 | #endif |
| 17 | |
| 18 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 19 | |
| 20 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) |
| 21 | |
| 22 | template <class _Arg, class _Result> |
| 23 | struct _LIBCPP_DEPRECATED_IN_CXX11 unary_function { |
| 24 | typedef _Arg argument_type; |
| 25 | typedef _Result result_type; |
| 26 | }; |
| 27 | |
| 28 | #endif // _LIBCPP_STD_VER <= 14 |
| 29 | |
| 30 | template <class _Arg, class _Result> |
| 31 | struct __unary_function_keep_layout_base { |
| 32 | #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS) |
| 33 | using argument_type _LIBCPP_DEPRECATED_IN_CXX17 = _Arg; |
| 34 | using result_type _LIBCPP_DEPRECATED_IN_CXX17 = _Result; |
| 35 | #endif |
| 36 | }; |
| 37 | |
| 38 | #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) |
| 39 | _LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 40 | template <class _Arg, class _Result> |
| 41 | using __unary_function _LIBCPP_NODEBUG = unary_function<_Arg, _Result>; |
| 42 | _LIBCPP_SUPPRESS_DEPRECATED_POP |
| 43 | #else |
| 44 | template <class _Arg, class _Result> |
| 45 | using __unary_function _LIBCPP_NODEBUG = __unary_function_keep_layout_base<_Arg, _Result>; |
| 46 | #endif |
| 47 | |
| 48 | _LIBCPP_END_NAMESPACE_STD |
| 49 | |
| 50 | #endif // _LIBCPP___FUNCTIONAL_UNARY_FUNCTION_H |
| 51 | |