Definition

Defined in the standard header functional, and in the nonstandard
backward-compatibility header function.h. The binary_compose
class is an SGI extension; it is not part of the C++ standard.

Template parameters

Parameter

Description

Default

AdaptableBinaryFunction

The type of the "outer" function in the function composition
operation. That is, if the binary_compose is a function object
h such that h(x) = f(g1(x), g2(x)), then AdaptableBinaryFunction
is the type of f.

AdaptableUnaryFunction1

The type of the first "inner" function in the function composition
operation. That is, if the binary_compose is a function object
h such that h(x) = f(g1(x), g2(x)), then AdaptableBinaryFunction
is the type of g1.

AdaptableUnaryFunction2

The type of the second "inner" function in the function composition
operation. That is, if the binary_compose is a function object
h such that h(x) = f(g1(x), g2(x)), then AdaptableBinaryFunction
is the type of g2.

Model of

Type requirements

AdaptableBinaryFunction must be a model of Adaptable Binary Function.
AdaptableUnaryFunction1 and AdaptableUnaryFunction2 must both
be models of Adaptable Unary Function.
The argument types of AdaptableUnaryFunction1 and
AdaptableUnaryFunction2 must be convertible to each other.
The result types of AdaptableUnaryFunction1 and
AdaptableUnaryFunction2 must be convertible, respectively, to
the first and second argument types of AdaptableBinaryFunction.

Creates a binary_compose object. If f, g, and g2 are, respectively,
of classes AdaptableBinaryFunction, AdaptableUnaryFunction1, and
AdaptableUnaryFunction2, then compose2(f, g1, g2) is equivalent to
binary_compose<AdaptableBinaryFunction, AdaptableUnaryFunction1,
AdaptableUnaryFunction2>(f, g1, g2), but is more convenient.
This is a global function, not a member function.

Notes

[1]
This is a form of function composition. The unary_compose
adaptor allows composition of Adaptable Unary Functions; note,
however, that once binary functions are introduced, there are several
possible patterns of function composition. The binary_compose
allows you to form a unary function by putting together two unary
functions and a binary function, but you could also, for example,
imagine putting together two unary functions and a binary function to
form a binary function. In that case, f, g1, and g2 would be
combined into a function object h such that h(x,y) = f(g1(x),
g2(y)).