1050b064fSChristopher Di Bella // -*- C++ -*- 2050b064fSChristopher Di Bella //===----------------------------------------------------------------------===// 3050b064fSChristopher Di Bella // 4050b064fSChristopher Di Bella // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5050b064fSChristopher Di Bella // See https://llvm.org/LICENSE.txt for license information. 6050b064fSChristopher Di Bella // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7050b064fSChristopher Di Bella // 8050b064fSChristopher Di Bella //===----------------------------------------------------------------------===// 9050b064fSChristopher Di Bella 10050b064fSChristopher Di Bella #ifndef _LIBCPP___FUNCTIONAL_POINTER_TO_UNARY_FUNCTION_H 11050b064fSChristopher Di Bella #define _LIBCPP___FUNCTIONAL_POINTER_TO_UNARY_FUNCTION_H 12050b064fSChristopher Di Bella 13050b064fSChristopher Di Bella #include <__config> 14050b064fSChristopher Di Bella #include <__functional/unary_function.h> 15050b064fSChristopher Di Bella 16050b064fSChristopher Di Bella #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 17050b064fSChristopher Di Bella # pragma GCC system_header 18050b064fSChristopher Di Bella #endif 19050b064fSChristopher Di Bella 20050b064fSChristopher Di Bella _LIBCPP_BEGIN_NAMESPACE_STD 21050b064fSChristopher Di Bella 22050b064fSChristopher Di Bella #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) 23050b064fSChristopher Di Bella 24050b064fSChristopher Di Bella template <class _Arg, class _Result> 25*e2c2ffbeSLouis Dionne class _LIBCPP_TEMPLATE_VIS 26*e2c2ffbeSLouis Dionne _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_unary_function : public __unary_function<_Arg, _Result> { 27050b064fSChristopher Di Bella _Result (*__f_)(_Arg); 289783f28cSLouis Dionne 29050b064fSChristopher Di Bella public: pointer_to_unary_function(_Result (* __f)(_Arg))309783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI explicit pointer_to_unary_function(_Result (*__f)(_Arg)) : __f_(__f) {} operator()319783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg __x) const { return __f_(__x); } 32050b064fSChristopher Di Bella }; 33050b064fSChristopher Di Bella 34050b064fSChristopher Di Bella template <class _Arg, class _Result> 359783f28cSLouis Dionne _LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (* __f)(_Arg))369783f28cSLouis Dionneptr_fun(_Result (*__f)(_Arg)) { 379783f28cSLouis Dionne return pointer_to_unary_function<_Arg, _Result>(__f); 389783f28cSLouis Dionne } 39050b064fSChristopher Di Bella 40050b064fSChristopher Di Bella #endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) 41050b064fSChristopher Di Bella 42050b064fSChristopher Di Bella _LIBCPP_END_NAMESPACE_STD 43050b064fSChristopher Di Bella 44050b064fSChristopher Di Bella #endif // _LIBCPP___FUNCTIONAL_POINTER_TO_UNARY_FUNCTION_H 45