⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _function_adaptors.h

📁 MONA是为数不多的C++语言编写的一个很小的操作系统
💻 H
📖 第 1 页 / 共 2 页
字号:
};#endif /*_STLP_DONT_RETURN_VOID && _STLP_NO_CLASS_PARTIAL_SPECIALIZATION && _STLP_MEMBER_TEMPLATE_CLASSES*/#if !defined(_STLP_DONT_RETURN_VOID) || !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) || !defined (_STLP_MEMBER_TEMPLATE_CLASSES)template <class _Ret, class _Tp>class mem_fun_t : public unary_function<_Tp*,_Ret> {  typedef _Ret (_Tp::*__fun_type)(void);public:  explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {}  _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }private:  __fun_type _M_f;};template <class _Ret, class _Tp>class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {  typedef _Ret (_Tp::*__fun_type)(void) const;public:  explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {}  _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }private:  __fun_type _M_f;};template <class _Ret, class _Tp>class mem_fun_ref_t : public unary_function<_Tp,_Ret> {  typedef _Ret (_Tp::*__fun_type)(void);public:  explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}  _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }private:  __fun_type _M_f;};template <class _Ret, class _Tp>class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {  typedef _Ret (_Tp::*__fun_type)(void) const;public:  explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}  _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }private:  __fun_type _M_f;};template <class _Ret, class _Tp, class _Arg>class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {  typedef _Ret (_Tp::*__fun_type)(_Arg);public:  explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}  _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }private:  __fun_type _M_f;};template <class _Ret, class _Tp, class _Arg>class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {  typedef _Ret (_Tp::*__fun_type)(_Arg) const;public:  explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}  _Ret operator()(const _Tp* __p, _Arg __x) const    { return (__p->*_M_f)(__x); }private:  __fun_type _M_f;};template <class _Ret, class _Tp, class _Arg>class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {  typedef _Ret (_Tp::*__fun_type)(_Arg);public:  explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}  _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }private:  __fun_type _M_f;};template <class _Ret, class _Tp, class _Arg>class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {  typedef _Ret (_Tp::*__fun_type)(_Arg) const;public:  explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}  _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }private:  __fun_type _M_f;};template <class _Arg, class _Result>class pointer_to_unary_function : public unary_function<_Arg, _Result> {protected:  _Result (*_M_ptr)(_Arg);public:  pointer_to_unary_function() {}  explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}  _Result operator()(_Arg __x) const { return _M_ptr(__x); }};template <class _Arg1, class _Arg2, class _Result>class pointer_to_binary_function :   public binary_function<_Arg1,_Arg2,_Result> {protected:    _Result (*_M_ptr)(_Arg1, _Arg2);public:    pointer_to_binary_function() {}    explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))       : _M_ptr(__x) {}    _Result operator()(_Arg1 __x, _Arg2 __y) const {      return _M_ptr(__x, __y);    }};#if defined(_STLP_DONT_RETURN_VOID) && !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)//Partial specialization for the void typetemplate <class _Tp>class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {  typedef void (_Tp::*__fun_type)(void);public:  explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}  void operator()(_Tp* __p) const { (__p->*_M_f)(); }private:  __fun_type _M_f;};template <class _Tp>class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {  typedef void (_Tp::*__fun_type)(void) const;public:  explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}  void operator()(const _Tp* __p) const { (__p->*_M_f)(); }private:  __fun_type _M_f;};template <class _Tp>class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {  typedef void (_Tp::*__fun_type)(void);public:  explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}  void operator()(_Tp& __r) const { (__r.*_M_f)(); }private:  __fun_type _M_f;};template <class _Tp>class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {  typedef void (_Tp::*__fun_type)(void) const;public:  explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}  void operator()(const _Tp& __r) const { (__r.*_M_f)(); }private:  __fun_type _M_f;};template <class _Tp, class _Arg>class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {  typedef void (_Tp::*__fun_type)(_Arg);public:  explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}  void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }private:  __fun_type _M_f;};template <class _Tp, class _Arg>class const_mem_fun1_t<void, _Tp, _Arg>   : public binary_function<const _Tp*,_Arg,void> {  typedef void (_Tp::*__fun_type)(_Arg) const;public:  explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}  void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }private:  __fun_type _M_f;};template <class _Tp, class _Arg>class mem_fun1_ref_t<void, _Tp, _Arg>  : public binary_function<_Tp,_Arg,void> {  typedef void (_Tp::*__fun_type)(_Arg);public:  explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}  void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }private:  __fun_type _M_f;};template <class _Tp, class _Arg>class const_mem_fun1_ref_t<void, _Tp, _Arg>  : public binary_function<_Tp,_Arg,void> {  typedef void (_Tp::*__fun_type)(_Arg) const;public:  explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}  void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }private:  __fun_type _M_f;};template <class _Arg>class pointer_to_unary_function : public unary_function<_Arg, void> {  typedef void (*__fun_type)(_Arg);  __fun_type _M_ptr;public:  pointer_to_unary_function() {}  explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {}  void operator()(_Arg __x) const { _M_ptr(__x); }};template <class _Arg1, class _Arg2>class pointer_to_binary_function : public binary_function<_Arg1,_Arg2,void> {  typedef void (*__fun_type)(_Arg1, _Arg2);  __fun_type _M_ptr;public:  pointer_to_binary_function() {}  explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {}  void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); }};#endif /*_STLP_DONT_RETURN_VOID && !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION*/#else /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*///mem_fun_ttemplate <class _Result, class _Tp>class mem_fun_t :   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr {  typedef typename    _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base;public:  explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}};//const_mem_fun_ttemplate <class _Result, class _Tp>class const_mem_fun_t :   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const {  typedef typename    _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base;public:  explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}};//mem_fun_ref_ttemplate <class _Result, class _Tp>class mem_fun_ref_t :  public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref {  typedef typename    _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base;public:  explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}};//const_mem_fun_ref_ttemplate <class _Result, class _Tp>class const_mem_fun_ref_t :  public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const {  typedef typename    _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base;public:  explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}};//mem_fun1_ttemplate <class _Result, class _Tp, class _Arg>class mem_fun1_t :  public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr {  typedef typename    _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base;public:  explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}};//const_mem_fun1_ttemplate <class _Result, class _Tp, class _Arg>class const_mem_fun1_t :  public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const {  typedef typename    _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base;public:  explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}};//mem_fun1_ref_ttemplate <class _Result, class _Tp, class _Arg>class mem_fun1_ref_t :  public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref {  typedef typename    _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base;public:  explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}};//const_mem_fun1_ttemplate <class _Result, class _Tp, class _Arg>class const_mem_fun1_ref_t :  public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const {  typedef typename    _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base;public:  explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}};template <class _Arg, class _Result>class pointer_to_unary_function :public _Ptr_fun1<_Result,_Arg> {  typedef typename     _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type;public:  explicit pointer_to_unary_function(__fun_type __f)    : _Ptr_fun1<_Result,_Arg>(__f) {}};template <class _Arg1, class _Arg2, class _Result>class pointer_to_binary_function :public _Ptr_fun2<_Result,_Arg1,_Arg2> {  typedef typename    _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type;public:  explicit pointer_to_binary_function(__fun_type __f)    : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {}};#endif /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/# if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)// Mem_fun adaptor helper functions.  There are only two://  mem_fun and mem_fun_ref.  (mem_fun1 and mem_fun1_ref //  are provided for backward compatibility, but they are no longer//  part of the C++ standard.)template <class _Result, class _Tp>inline mem_fun_t<_Result,_Tp> mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); }template <class _Result, class _Tp>inline const_mem_fun_t<_Result,_Tp> mem_fun(_Result (_Tp::*__f)() const)  { return const_mem_fun_t<_Result,_Tp>(__f); }template <class _Result, class _Tp>inline mem_fun_ref_t<_Result,_Tp> mem_fun_ref(_Result (_Tp::*__f)())  { return mem_fun_ref_t<_Result,_Tp>(__f); }template <class _Result, class _Tp>inline const_mem_fun_ref_t<_Result,_Tp> mem_fun_ref(_Result (_Tp::*__f)() const)  { return const_mem_fun_ref_t<_Result,_Tp>(__f); }template <class _Result, class _Tp, class _Arg>inline mem_fun1_t<_Result,_Tp,_Arg> mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }template <class _Result, class _Tp, class _Arg>inline const_mem_fun1_t<_Result,_Tp,_Arg> mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }template <class _Result, class _Tp, class _Arg>inline mem_fun1_ref_t<_Result,_Tp,_Arg> mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }template <class _Result, class _Tp, class _Arg>inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))//  mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,//  but they are provided for backward compatibility.template <class _Result, class _Tp, class _Arg>inline mem_fun1_t<_Result,_Tp,_Arg> mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }template <class _Result, class _Tp, class _Arg>inline const_mem_fun1_t<_Result,_Tp,_Arg> mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }template <class _Result, class _Tp, class _Arg>inline mem_fun1_ref_t<_Result,_Tp,_Arg> mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }template <class _Result, class _Tp, class _Arg>inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }# endif /* _STLP_NO_EXTENSIONS */# endif /* _STLP_MEMBER_POINTER_PARAM_BUG */template <class _Arg, class _Result>inline pointer_to_unary_function<_Arg, _Result>ptr_fun(_Result (*__f)(_Arg)) { return pointer_to_unary_function<_Arg, _Result>(__f); }template <class _Arg1, class _Arg2, class _Result>inline pointer_to_binary_function<_Arg1,_Arg2,_Result> ptr_fun(_Result (*__f)(_Arg1, _Arg2)) { return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); }_STLP_END_NAMESPACE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -