Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use C++ STL bind1st bind2nd bind

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report