1) Theoretical knowledge of function adapters
2) Common function function adapter
The standard library provides a set of function adapters that specialize or extend a unary and two-tuple function object. Common adapters are:
1. Binder (Binder): Binders Convert a two-tuple function object to a unary function object by binding an argument to a special value. The C + + standard library provides two predefined binder adapters: bind1st and bind2nd, which bind values to the first argument of a two-tuple function object, which is bound on the second argument.
2. Inversion (negator): Negator is a function adapter that flips the value of a function object. The standard library provides two predefined ngeator adapters: Not1 flips The true value of a unary predefined function object, and Not2 flips the true value of a two-tuple predicate function.
A list of commonly used function adapters is as follows:
bind1st (OP, value)
bind2nd (OP, value)
Not1 (OP)
Not2 (OP)
Mem_fun_ref (OP)
Mem_fun (OP)
Ptr_fun (OP)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
STL algorithm design concept-Function adapter