当前位置:网站首页>第21回---第30回
第21回---第30回
2022-07-27 14:45:00 【andrewhxc】
第21回


小写字母比大写字母大,字母表后面的字母比前面的字母大
第22回

map是保存键值对的,map的键不允许重复,而multimap允许键重复


第23回

set里的数据会自动排序
set不允许数据重复,multiset里面可以有重复数据
第24回

函数对象是一个对象,但用起来像一个函数


函数适配器可以将不同的函数对象组合起来,然后传递给算法

第25回

下图红框中就是函数对象,表示set中的数据按照从小到大排序

将函数用于算法(下图1和图2)

![]()
将函数对象用于算法,注意函数对象中的成员函数必须叫做“operator”


函数对象相比于函数的优点:函数对象是一个智能型的函数,而且有它自己的类型,函数对象一般比普通函数速度快,而且函数对象能够有自己的状态
第26回

count_if 和 count 功能相同,只是 count_if 可以传入函数或函数对作为谓词,如果这个函数只有1个参数,我们就叫这个谓词为“一元谓词”
返回值是bool类型数据的函数或函数对象称为 “谓词”


第27回

上图的四个算法对所有的顺序容器和关联容器都适用
第28回


find() 和 find_if() 这两个算法对所有容器都使用,注意,string是特殊的容器,而且只能使用成员函数 find() 函数进行查找,且string的find()函数返回的不是迭代器而是下标

find() 和 find_if() 这两个算法都是线性查找,速度较慢
第29回


第30回

边栏推荐
- The 4.3 billion euro cash acquisition of OSRAM failed! AMS said it would continue to acquire
- JSP基础
- JSP Foundation
- 快速高效删除node_modules
- Chuanyin holdings disclosed that it was prosecuted by Huawei: a case has been filed, involving an amount of 20million yuan
- Join hands with sifive, Galanz will enter the semiconductor field! Exposure of two self-developed chips
- DRF learning notes (IV): DRF view
- Leetcode234 question - simple method to judge palindrome linked list
- Openwrt new platform compilation
- The first week of C language learning - the history of C language
猜你喜欢

Flume incrementally collects MySQL data to Kafka

Yys mouse connector

Servlet基础知识点

Solve the problem that Flink cannot be closed normally after startup

使用transform:translate()出现内容模糊问题

SolidWorks Simulation曲线图属性设定

Solve mt7620 continuous cycle uboot (LZMA error 1 - must reset board to recover)

Characters generated by JMeter function assistant in jmeter5.3 and later versions cannot be copied when they are grayed out

Time series - use tsfresh for classification tasks

企业运维安全就用行云管家堡垒机!
随机推荐
快速高效删除node_modules
google chrome revercecaptcha广告屏蔽
Common Oracle statements
Solve the problem that ${pagecontext.request.contextpath} is invalid
2021-03-09
Baidu picture copy picture address
matlab legend用法
Use of arrow function
Characters generated by JMeter function assistant in jmeter5.3 and later versions cannot be copied when they are grayed out
Excel提取重复项
Content ambiguity occurs when using transform:translate()
Find active SQL connections in SQL Server
The first week of C language learning - the history of C language
Oracle 常用语句
多行文本溢出打点
Determine the exact type of data
Leetcode 226 flip binary tree (recursive)
DRF learning notes (IV): DRF view
It can carry 100 people! Musk releases the strongest "starship" in history! Go to Mars as early as next year!
Firefox old version