DescriptionBinder2nd is a function object adaptor: it is used to transform an adaptable binary function into an adaptable unary function. Specifically, if f is an object of class binder2nd<AdaptableBinaryFunction>, then f(x) returns F(x, c), where F is an object of class AdaptableBinaryFunction and where c is a constant. Both F and c are passed as arguments to binder2nd's constructor. 
The easiest way to create a binder2nd is not to call the constructor explicitly, but instead to use the helper function bind2nd.
ExampleFinds the first positive number in a list.
list<int> L; ... list<int>::iterator first_positive = find_if(L.begin(), L.end(), bind2nd(greater<int>(), 0)); assert(first_positive == L.end() || *first_positive > 0);
DefinitionDefined in the standard header functional, and in the nonstandard backward-compatibility header function.h.
Model ofAdaptable Unary Function
Type requirementsAdaptableBinaryFunction must be a model of Adaptable Binary Function.
Public base classes
New membersThese members are not defined in the Adaptable Unary Function requirements, but are specific to binder2nd.
 Intuitively, you can think of this operation as "binding" the second argument of a binary function to a constant, thus yielding a unary function. This is a special case of a closure.
See alsoThe function object overview, binder1st, Adaptable Unary Function, Adaptable Binary Function
Copyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation