📄 functio2.html
字号:
<H2><A NAME="greater"><CODE>greater</CODE></A></H2><PRE>template<class Ty> struct <B>greater</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, bool> { bool <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left > right</CODE>. The member function defines a<A HREF="utility.html#total ordering">total ordering</A>if <CODE>Ty</CODE> is an object pointer type. (It will compare two pointer valuesconsistently even if they don't point into the same array.)</P><H2><A NAME="greater_equal"><CODE>greater_equal</CODE></A></H2><PRE>template<class Ty> struct <B>greater_equal</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, bool> { bool <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left >= right</CODE>. The member function defines a<A HREF="utility.html#total ordering">total ordering</A>if <CODE>Ty</CODE> is an object pointer type. (It will compare two pointer valuesconsistently even if they don't point into the same array.)</P><H2><A NAME="less"><CODE>less</CODE></A></H2><PRE>template<class Ty> struct <B>less</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, bool> { bool <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left < right</CODE>. The member function defines a<A HREF="utility.html#total ordering">total ordering</A>if <CODE>Ty</CODE> is an object pointer type. (It will compare two pointer valuesconsistently even if they don't point into the same array.)</P><H2><A NAME="less_equal"><CODE>less_equal</CODE></A></H2><PRE>template<class Ty> struct <B>less_equal</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, bool> { bool <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left <= right</CODE>. The member function defines a<A HREF="utility.html#total ordering">total ordering</A>if <CODE>Ty</CODE> is an object pointer type. (It will compare two pointer valuesconsistently even if they don't point into the same array.)</P><H2><A NAME="logical_and"><CODE>logical_and</CODE></A></H2><PRE>template<class Ty> struct <B>logical_and</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, bool> { bool <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left && right</CODE>.</P><H2><A NAME="logical_not"><CODE>logical_not</CODE></A></H2><PRE>template<class Ty> struct <B>logical_not</B> : public <A HREF="#unary_function">unary_function</A><Ty, bool> { bool <B>operator()</B>(const Ty& left) const; };</PRE><P>The template class defines its member function as returning<CODE>!left</CODE>.</P><H2><A NAME="logical_or"><CODE>logical_or</CODE></A></H2><PRE>template<class Ty> struct <B>logical_or</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, bool> { bool <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left || right</CODE>.</P><H2><A NAME="mem_fun"><CODE>mem_fun</CODE></A></H2><PRE>template<class Result, class Ty> mem_fun_t<Result, Ty> <B>mem_fun</B>(Result (Ty::*pm)());template<class Result, class Ty, class Arg> mem_fun1_t<Result, Ty, Arg> <B>mem_fun</B>(Result (Ty::*pm)(Arg));template<class Result, class Ty> const_mem_fun_t<Result, Ty> <B>mem_fun</B>(Result (Ty::*pm)() const);template<class Result, class Ty, class Arg> const_mem_fun1_t<Result, Ty, Arg> <B>mem_fun</B>(Result (Ty::*pm)(Arg) const);</PRE><P>The template function returns <CODE>pm</CODE> cast to the return type.</P><H2><A NAME="mem_fun_ref"><CODE>mem_fun_ref</CODE></A></H2><PRE>template<class Result, class Ty> mem_fun_ref_t<Result, Ty> <B>mem_fun_ref</B>(Result (Ty::*pm)());template<class Result, class Ty, class Arg> mem_fun1_ref_t<Result, Ty, Arg> <B>mem_fun_ref</B>(Result (Ty::*pm)(Arg));template<class Result, class Ty> const_mem_fun_ref_t<Result, Ty> <B>mem_fun_ref</B>(Result (Ty::*pm)() const);template<class Result, class Ty, class Arg> const_mem_fun1_ref_t<Result, Ty, Arg> <B>mem_fun_ref</B>(Result (Ty::*pm)(Arg) const);</PRE><P>The template function returns <CODE>pm</CODE> cast to the return type.</P><H2><A NAME="mem_fun_t"><CODE>mem_fun_t</CODE></A></H2><PRE>template<class Result, class Ty> struct <B>mem_fun_t</B> : public <A HREF="#unary_function">unary_function</A><Ty *, Result> { explicit <B>mem_fun_t</B>(Result (Ty::*pm)()); Result <B>operator()</B>(Ty *pleft) const; };</PRE><P>The template class stores a copy of <CODE>pm</CODE>, whichmust be a pointer to a member function of class <CODE>Ty</CODE>, ina private member object.It defines its member function <B><CODE>operator()</CODE></B>as returning <CODE>(pleft->*pm)()</CODE>.</P><H2><A NAME="mem_fun_ref_t"><CODE>mem_fun_ref_t</CODE></A></H2><PRE>template<class Result, class Ty> struct <B>mem_fun_ref_t</B> : public <A HREF="#unary_function">unary_function</A><Ty, Result> { explicit <B>mem_fun_t</B>(Result (Ty::*pm)()); Result <B>operator()</B>(Ty& left) const; };</PRE><P>The template class stores a copy of <CODE>pm</CODE>, whichmust be a pointer to a member function of class <CODE>Ty</CODE>, ina private member object.It defines its member function <B><CODE>operator()</CODE></B>as returning <CODE>(left.*pm)()</CODE>.</P><H2><A NAME="mem_fun1_t"><CODE>mem_fun1_t</CODE></A></H2><PRE>template<class Result, class Ty, class Arg> struct <B>mem_fun1_t</B> : public <A HREF="#binary_function">binary_function</A><Ty *, Arg, Result> { explicit <B>mem_fun1_t</B>(Result (Ty::*pm)(Arg)); Result <B>operator()</B>(Ty *pleft, Arg right) const; };</PRE><P>The template class stores a copy of <CODE>pm</CODE>, whichmust be a pointer to a member function of class <CODE>Ty</CODE>, ina private member object.It defines its member function <B><CODE>operator()</CODE></B>as returning <CODE>(pleft->*pm)(right)</CODE>.</P><H2><A NAME="mem_fun1_ref_t"><CODE>mem_fun1_ref_t</CODE></A></H2><PRE>template<class Result, class Ty, class Arg> struct <B>mem_fun1_ref_t</B> : public <A HREF="#binary_function">binary_function</A><Ty, Arg, Result> { explicit <B>mem_fun1_ref_t</B>(Result (Ty::*pm)(Arg)); Result <B>operator()</B>(Ty& left, Arg right) const; };</PRE><P>The template class stores a copy of <CODE>pm</CODE>, whichmust be a pointer to a member function of class <CODE>Ty</CODE>, ina private member object.It defines its member function <B><CODE>operator()</CODE></B>as returning <CODE>(left.*pm)(right)</CODE>.</P><H2><A NAME="minus"><CODE>minus</CODE></A></H2><PRE>template<class Ty> struct <B>minus</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, Ty> { Ty <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left - right</CODE>.</P><H2><A NAME="modulus"><CODE>modulus</CODE></A></H2><PRE>template<class Ty> struct <B>modulus</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, Ty> { Ty <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left % right</CODE>.</P><H2><A NAME="multiplies"><CODE>multiplies</CODE></A></H2><PRE>template<class Ty> struct <B>multiplies</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, Ty> { Ty <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left * right</CODE>.</P><H2><A NAME="negate"><CODE>negate</CODE></A></H2><PRE>template<class Ty> struct <B>negate</B> : public <A HREF="#unary_function">unary_function</A><Ty, Ty> { Ty <B>operator()</B>(const Ty& left) const; };</PRE><P>The template class defines its member function as returning<CODE>-left</CODE>.</P><H2><A NAME="not1"><CODE>not1</CODE></A></H2><PRE>template<class Fn1> <A HREF="#unary_negate">unary_negate</A><Fn1> <B>not1</B>(const Fn1& func);</PRE><P>The template function returns<CODE><A HREF="#unary_negate">unary_negate</A><Fn1>(func)</CODE>.</P><H2><A NAME="not2"><CODE>not2</CODE></A></H2><PRE>template<class Fn2> <A HREF="#binary_negate">binary_negate</A><Fn2> <B>not2</B>(const Fn2& func);</PRE><P>The template function returns<CODE><A HREF="#binary_negate">binary_negate</A><Fn2>(func)</CODE>.</P><H2><A NAME="not_equal_to"><CODE>not_equal_to</CODE></A></H2><PRE>template<class Ty> struct <B>not_equal_to</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, bool> { bool <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left != right</CODE>.</P><H2><A NAME="plus"><CODE>plus</CODE></A></H2><PRE>template<class Ty> struct <B>plus</B> : public <A HREF="#binary_function">binary_function</A><Ty, Ty, Ty> { Ty <B>operator()</B>(const Ty& left, const Ty& right) const; };</PRE><P>The template class defines its member function as returning<CODE>left + right</CODE>.</P><H2><A NAME="pointer_to_binary_function"><CODE>pointer_to_binary_function</CODE></A></H2><PRE>template<class Arg1, class Arg2, class Result> class <B>pointer_to_binary_function</B> : public <A HREF="#binary_function">binary_function</A><Arg1, Arg2, Result> {public: explicit <B>pointer_to_binary_function</B>( Result (*pfunc)(Arg1, Arg2)); Result <B>operator()</B>(const Arg1 left, const Arg2 right) const; };</PRE><P>The template class stores a copy of <CODE>pfunc</CODE>.It defines its member function <B><CODE>operator()</CODE></B>as returning <CODE>(*pfunc)(left, right)</CODE>.</P><H2><A NAME="pointer_to_unary_function"><CODE>pointer_to_unary_function</CODE></A></H2><PRE>template<class Arg, class Result> class <B>pointer_to_unary_function</B> : public <A HREF="#unary_function">unary_function</A><Arg, Result> {public: explicit <B>pointer_to_unary_function</B>( Result (*pfunc)(Arg)); Result <B>operator()</B>(const Arg left) const; };</PRE><P>The template class stores a copy of <CODE>pfunc</CODE>.It defines its member function <B><CODE>operator()</CODE></B>as returning <CODE>(*pfunc)(left)</CODE>.</P><H2><A NAME="ptr_fun"><CODE>ptr_fun</CODE></A></H2><PRE>template<class Arg, class Result> pointer_to_unary_function<Arg, Result> <B>ptr_fun</B>(Result (*pfunc)(Arg));template<class Arg1, class Arg2, class Result> pointer_to_binary_function<Arg1, Arg2, Result> <B>ptr_fun</B>(Result (*pfunc)(Arg1, Arg2));</PRE><P>The first template function returns<CODE><A HREF="#pointer_to_unary_function">pointer_to_unary_function</A><Arg, Result>(pfunc)</CODE>.</P><P>The second template function returns<CODE><A HREF="#pointer_to_binary_function">pointer_to_binary_function</A><Arg1, Arg2, Result>(pfunc)</CODE>.</P><H2><A NAME="unary_function"><CODE>unary_function</CODE></A></H2><PRE>template<class Arg, class Result> struct <B>unary_function</B> { typedef Arg <B>argument_type</B>; typedef Result <B>result_type</B>; };</PRE><P>The template class serves as a base for classes that definea member function of the form:</P><PRE>result_type operator()(const argument_type&) const</PRE><P>or a similar form taking one argument.</P><P>Hence, all such<B><A NAME="unary functions">unary functions</A></B>can refer to their sole argument type as<B><A NAME="unary_function::argument_type"><CODE>argument_type</CODE></A></B>and their return type as<B><A NAME="unary_function::result_type"><CODE>result_type</CODE></A></B>.</P><H2><A NAME="unary_negate"><CODE>unary_negate</CODE></A></H2><PRE>template<class Fn1> class <B>unary_negate</B> : public <A HREF="#unary_function">unary_function</A>< typename Fn1::argument_type, bool> {public: explicit <B>unary_negate</B>(const Fn1& Func); bool <B>operator()</B>( const typename Fn1::argument_type& left) const; };</PRE><P>The template class stores a copy of <CODE>func</CODE>, whichmust be a <A HREF="#unary functions">unary function</A> object.It defines its member function <B><CODE>operator()</CODE></B>as returning <CODE>!func(left)</CODE>.</P><HR><P>See also the<B><A HREF="index.html#Table of Contents">Table of Contents</A></B> and the<B><A HREF="_index.html">Index</A></B>.</P><P><I><A HREF="crit_pjp.html">Copyright</A> © 1994-2002by P.J. Plauger. Portions derived from work<A HREF="crit_hp.html">copyright</A> © 1994by Hewlett-Packard Company. All rights reserved.</I></P><!--V4.01:1125--></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -