Day.50———长期更新补充C++知识——STL、string类、vector类、map类、unordered_set类

全套细节

参考资料:https://www.runoob.com/cplusplus/cpp-tutorial.html

STL——标准模板库

点击了解 http://c.biancheng.net/stl/

常用的容器
在这里插入图片描述
常用的算法
在这里插入图片描述

string类:

http://c.biancheng.net/view/400.html

vector类:

https://www.runoob.com/w3cnote/cpp-vector-container-analysis.html

map类

基础博客遍历
unordered_map:https://blog.csdn.net/fcku_88/article/details/88353431

unordered_set类

http://c.biancheng.net/view/546.html

	//常用的操作: 直接插入元素:set.insert(...);查找是否存在元素:set.count(...);删除元素set.erase(...)
	vector<string> words(4);
	words[0] = "time";
	words[1] = "me";
	words[2] = "apple";
	words[3] = "tree";
	unordered_set<string> set(words.begin(), words.end()); //将vector写入哈希表
	unordered_set<string>::iterator it;                    //这个算子很好用,可以用来遍历
	int num = 0;
	for(int i=0; i<words.size(); i++)
	{
		string str = words[i];
		for(int j=1; j<words[i].size(); j++)
		{
			set.erase( str.substr(j) );
		}
	}
	//遍历
	for(it = set.begin(); it!=set.end(); it++)
	{
			num += ( it->size()+1 );
	}

C++运算符

点击链接:https://www.runoob.com/cplusplus/cpp-operators.html

仿函数 functor

参考博文:https://www.cnblogs.com/decade-dnbc66/p/5347088.html

new 总结

参考博文1:https://blog.csdn.net/bbs375/article/details/53202079
参考博文2:https://www.cnblogs.com/lustar/p/10717502.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值