.\" ident @(#)binary_function.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH binary_function 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2binary_function\fP \ - Base class for creating binary function objects. .SH SYNOPSIS .br #include .br template .RE .RS 3 struct binary_function{ .RE .RS 8 typedef Arg1 first_argument_type; .br typedef Arg2 second_argument_type; .br typedef Result result_type; .RE .RS 4 }; .SH DESCRIPTION Function objects are objects with an \f2operator()\fP 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 \f2operator()\fP defined or a pointer to a function. The Standard C++ Library includes 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. Function objects that take two arguments are called binary function objects. Binary function objects are required to include the typedefs \f2first_argument_type\fP, \f2second_argument_type\fP, and \f2result_type\fP. The binary_function class makes the task of creating templatized binary function objects easier by including the necessary typedefs for a binary function object. You can create your own binary function objects by inheriting from binary_function. .SH SEE ALSO Function_Objects, unary_function, the Function Objects section of the User's Guide.