全套细节
参考资料: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