STL Algorithm Design Concept-function Adapter
1) theoretical knowledge of function adapters
2) common function adapters
The standard library provides a set of function adapters for specialization or expansion of mona1 and binary function objects. Common adapters are:
1. binder: binder converts a real parameter of a binary function object to a special value. The C ++ Standard Library provides two predefined binder adapters: bind1st and bind2nd. The former binds the value to the first real parameter of the binary function object, the latter is bound to the second real parameter.
2. negator: negator is a function adapter used to flip the value of a function object. The standard library provides two predefined ngeator adapters: not1 is used to flip the true values of a one-dimensional predefined function object, while not2 is used to flip the true values of binary predicates.
The 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)