SGI Logo


binary_function<Arg1, Arg2, Result>

Category: functors Component type: type

Description

Binary_function is an empty base class: it contains no member functions or member variables, but only type information. The only reason it exists is to make it more convenient to define types that are models of the concept Adaptable Binary Function. Specifically, any model of Adaptable Binary Function must define nested typedefs. Those typedefs are provided by the base class binary_function.

Example

struct exponentiate : public binary_function<double, double, double> {
    double operator()(double x, double y) { return pow(x, y); }
};

Definition

Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h.

Template parameters

Parameter Description Default
Arg1 The function object's first argument type  
Arg2 The function object's second argument type  
Result The function object's result type  

Model of

Assignable, Default Constructible

Type requirements

Public base classes

None.

Members

Member Where defined Description
first_argument_type unary_function See below.
second_argument_type unary_function See below.
result_type unary_function See below.

New members

These members are not defined in the Assignable and Default Constructible requirements, but are specific to unary_function.
Member Description
first_argument_type The function object's first argument type. This is a typedef for the template parameter Arg1.
second_argument_type The function object's second argument type. This is a typedef for the template parameter Arg2.
result_type The function object's result type. This is a typedef for the template parameter Result.

Notes

See also

The Function Object overview, Adaptable Binary Function, unary_function


STL Main Page

Contact Us | Site Map | Trademarks | Privacy | Using this site means you accept its Terms of Use
Copyright © 2009 - 2014 Silicon Graphics International. All rights reserved.