STL Algorithm Design Concept-function Adapter

Source: Internet
Author: User

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)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.