Back to home page

EIC code displayed by LXR

 
 

    


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

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___FUNCTIONAL_MEM_FN_H
0011 #define _LIBCPP___FUNCTIONAL_MEM_FN_H
0012 
0013 #include <__config>
0014 #include <__functional/binary_function.h>
0015 #include <__functional/weak_result_type.h>
0016 #include <__type_traits/invoke.h>
0017 #include <__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 __invoke_result_t<const _Tp&, _ArgTypes...>
0040   operator()(_ArgTypes&&... __args) const _NOEXCEPT_(__is_nothrow_invocable_v<const _Tp&, _ArgTypes...>) {
0041     return std::__invoke(__f_, std::forward<_ArgTypes>(__args)...);
0042   }
0043 };
0044 
0045 template <class _Rp, class _Tp>
0046 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __mem_fn<_Rp _Tp::*> mem_fn(_Rp _Tp::*__pm) _NOEXCEPT {
0047   return __mem_fn<_Rp _Tp::*>(__pm);
0048 }
0049 
0050 _LIBCPP_END_NAMESPACE_STD
0051 
0052 #endif // _LIBCPP___FUNCTIONAL_MEM_FN_H