Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:31

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CXX03___FUNCTIONAL_MEM_FN_H
0011 #define _LIBCPP___CXX03___FUNCTIONAL_MEM_FN_H
0012 
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__functional/binary_function.h>
0015 #include <__cxx03/__functional/invoke.h>
0016 #include <__cxx03/__functional/weak_result_type.h>
0017 #include <__cxx03/__utility/forward.h>
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 template <class _Tp>
0026 class __mem_fn : public __weak_result_type<_Tp> {
0027 public:
0028   // types
0029   typedef _Tp type;
0030 
0031 private:
0032   type __f_;
0033 
0034 public:
0035   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
0036 
0037   // invoke
0038   template <class... _ArgTypes>
0039   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
0040 
0041   typename __invoke_return<type, _ArgTypes...>::type
0042   operator()(_ArgTypes&&... __args) const {
0043     return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
0044   }
0045 };
0046 
0047 template <class _Rp, class _Tp>
0048 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn<_Rp _Tp::*> mem_fn(_Rp _Tp::*__pm) _NOEXCEPT {
0049   return __mem_fn<_Rp _Tp::*>(__pm);
0050 }
0051 
0052 _LIBCPP_END_NAMESPACE_STD
0053 
0054 #endif // _LIBCPP___CXX03___FUNCTIONAL_MEM_FN_H