xref: /llvm-project/libcxx/include/__functional/pointer_to_binary_function.h (revision e2c2ffbe7a1b5d9e32a2ce64279475b50c4cba5b)
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_BINARY_FUNCTION_H
11050b064fSChristopher Di Bella #define _LIBCPP___FUNCTIONAL_POINTER_TO_BINARY_FUNCTION_H
12050b064fSChristopher Di Bella 
13050b064fSChristopher Di Bella #include <__config>
14050b064fSChristopher Di Bella #include <__functional/binary_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 _Arg1, class _Arg2, class _Result>
25*e2c2ffbeSLouis Dionne class _LIBCPP_TEMPLATE_VIS
26*e2c2ffbeSLouis Dionne _LIBCPP_DEPRECATED_IN_CXX11 pointer_to_binary_function : public __binary_function<_Arg1, _Arg2, _Result> {
27050b064fSChristopher Di Bella   _Result (*__f_)(_Arg1, _Arg2);
289783f28cSLouis Dionne 
29050b064fSChristopher Di Bella public:
pointer_to_binary_function(_Result (* __f)(_Arg1,_Arg2))309783f28cSLouis Dionne   _LIBCPP_HIDE_FROM_ABI explicit pointer_to_binary_function(_Result (*__f)(_Arg1, _Arg2)) : __f_(__f) {}
operator()319783f28cSLouis Dionne   _LIBCPP_HIDE_FROM_ABI _Result operator()(_Arg1 __x, _Arg2 __y) const { return __f_(__x, __y); }
32050b064fSChristopher Di Bella };
33050b064fSChristopher Di Bella 
34050b064fSChristopher Di Bella template <class _Arg1, class _Arg2, class _Result>
359783f28cSLouis Dionne _LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI pointer_to_binary_function<_Arg1, _Arg2, _Result>
ptr_fun(_Result (* __f)(_Arg1,_Arg2))369783f28cSLouis Dionne ptr_fun(_Result (*__f)(_Arg1, _Arg2)) {
379783f28cSLouis Dionne   return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__f);
389783f28cSLouis Dionne }
39050b064fSChristopher Di Bella 
40050b064fSChristopher Di Bella #endif
41050b064fSChristopher Di Bella 
42050b064fSChristopher Di Bella _LIBCPP_END_NAMESPACE_STD
43050b064fSChristopher Di Bella 
44050b064fSChristopher Di Bella #endif // _LIBCPP___FUNCTIONAL_POINTER_TO_BINARY_FUNCTION_H
45