📄 bin_7851.htm
字号:
<HTML><TITLE>binary_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>binary_function</H2>
<HR><PRE> Function Object</PRE><HR>
<A NAME="Summary"><H3>Summary</H3></A>
<P>Base class for creating binary function objects.</P>
<H3>Contents</H3>
<UL>
<A HREF="#Synopsis"><LI>Synopsis</LI></A>
<A HREF="#Description"><LI>Description</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 Arg1, class Arg2, class Result>
struct binary_function{
typedef Arg1 first_argument_type;
typedef Arg2 second_argument_type;
typedef Result result_type;
};
</PRE>
<A NAME="Description"><H3>Description</H3></A>
<P>Function objects are objects with an <SAMP>operator()</SAMP> defined. They are important for the effective use of the standard library's generic algorithms, because the interface for each algorithmic template can accept either an object with an <SAMP>operator()</SAMP> defined or a pointer to a function. The Standard C++ Library provides both a standard set of function objects, and a pair of classes that you can use as the base for creating your own function objects. </P>
<P>Function objects that take two arguments are called <I>binary function objects.</I> Binary function objects are required to provide the typedefs <SAMP>first_argument_type</SAMP>, <SAMP>second_argument_type</SAMP>, and <SAMP>result_type</SAMP>. The <B><I>binary_function</B></I> class makes the task of creating templated binary function objects easier by providing the necessary typedefs for a binary function object. You can create your own binary function objects by inheriting from <B><I>binary_function</B></I>.</P>
<A NAME="See Also"><H3>See Also</H3></A>
<P><A HREF="Fun_7437.htm"><B><I>Function Objects</B></I></A>, <A HREF="una_4659.htm"><B><I>unary_function</B></I></A>, the Function Objects section of the User's Guide.</P>
<HR>
<A HREF="Bid_7861.htm"><IMG SRC="images/prev.gif"></A> <A HREF="ref.htm#contents"><IMG SRC="images/toc.gif"></A> <A HREF="bin_1825.htm"><IMG SRC="images/next.gif"></A></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -