📄 poi_7375.htm
字号:
<HTML><TITLE>pointer_to_unary_function</TITLE><BODY>
<A HREF="ref.htm"><IMG SRC="images/banner.gif"></A>
<P><STRONG>Click on the banner to return to the Class Reference home page.</STRONG></P>
<P>©Copyright 1996 Rogue Wave Software</P>
<H2>pointer_to_unary_function</H2>
<HR><PRE> Function Object</PRE><HR>
<A NAME="Summary"><H3>Summary</H3></A>
<P>A function object class that adapts a <I>pointer to a function </I>to work where a <A HREF="una_4659.htm"><B><I>unary_function</B></I></A> is called for.</P>
<H3>Contents</H3>
<UL>
<A HREF="#Synopsis"><LI>Synopsis</LI></A>
<A HREF="#Description"><LI>Description</LI></A>
<A HREF="#Interface"><LI>Interface</LI></A>
<A HREF="#See Also"><LI>See Also</LI></A>
</UL>
<A NAME="Synopsis"><H3>Synopsis</H3></A>
<PRE>#include <functional></PRE>
<PRE>
template <class Arg, class Result>
class <B>pointer_to_unary_function</B> : public unary_function<Arg, Result>;
</PRE>
<A NAME="Description"><H3>Description</H3></A>
<P>The <B><I>pointer_to_unary_function</B></I> class encapsulates a pointer to a single-argument function. The class provides an <SAMP>operator()</SAMP> so that the resulting object serves as a function object for that function.</P>
<P>The <SAMP>ptr_fun</SAMP> function is overloaded to create instances of <B><I>pointer_to_unary_function</B></I> when provided with the appropriate pointer to a function. </P>
<A NAME="Interface"><H3>Interface</H3></A>
<PRE>template <class Arg, class Result>
class pointer_to_unary_function : public unary_function<Arg, Result> {
public:
typedef typename unary_function<Arg,Result>::argument_type
argument_type;
typedef typename unary_function<Arg,Result>::result_type
result_type;
explicit pointer_to_unary_function (Result (*f)(Arg));
Result operator() (const Arg&) const;
};
template<class Arg, class Result>
pointer_to_unary_function<Arg, Result>
ptr_fun (Result (*f)(Arg));
</PRE>
<A NAME="See Also"><H3>See Also</H3></A>
<P><A HREF="Fun_7437.htm"><B><I>Function Objects</B></I></A>, <A HREF="poi_3537.htm"><B><I>pointer_to_binary_function</B></I></A>, <A HREF="ptr_4059.htm"><B><I>ptr_fun</B></I></A>, <A HREF="una_4659.htm"><B><I>unary_function</B></I></A></P>
<HR>
<A HREF="poi_3537.htm"><IMG SRC="images/prev.gif"></A> <A HREF="ref.htm#contents"><IMG SRC="images/toc.gif"></A> <A HREF="pop_9596.htm"><IMG SRC="images/next.gif"></A></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -