How to use C++ STL bind1st bind2nd bind
This article mainly explains "how to use C++ STL bind1st bind2nd bind". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use C++ STL bind1st bind2nd bind.
Description
Bind1st () and bind2nd (), which are already deprecated in Category 11, are recommended to use the new standard bind ().
The following explains the use of bind1st () and bind2nd (), and then explains the use of bind ().
Header file
# include
Action
Both bind1st () and bind2nd () convert a binary function to a unary function by binding one of the parameters.
Bind1st () is the first parameter to bind.
Bind2nd () is the second parameter bound.
Example # include # include # include using namespace std; int main () {int numbers [] = {10 cout 20, 30, 40, 50, 10}; int cx; cx = count_if (numbers, numbers + 6, bind2nd (less (), 40)); cout