STL
_sunshine
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
STL 计数(count,count_if)的用法
#include #include #include #include #include #include "Generators.h"//见同类填充与生成章节 #include "PrintSequence.h" using namespace std; int main() { vector v; generate_n(back_inserter(v), 50, CharGen原创 2013-03-26 11:32:38 · 942 阅读 · 0 评论 -
STL填充与生成(fill,fill_n,generate,generate_n)的用法
//Generators.h #ifndef GENERATORS_H #define GENERATORS_H #include #include #include class SkipGen { int i; int skp; public: SkipGen(int start = 0, int skip = 1) :i(start), skp(skip){} int op原创 2013-03-26 11:24:31 · 1088 阅读 · 0 评论 -
STL操作序列
//NString.h #ifndef NSTRING_H #define NSTRING_H #include #include #include #include #include typedef std::pair psi; bool operator==(const psi& l, const psi& r) { return l.first == r.first; }原创 2013-03-26 15:21:52 · 557 阅读 · 0 评论 -
STL 查找与替换
//SearchReplace.cpp #include #include #include #include "PrintSequence.h" using namespace std; struct PlusOne { bool operator()(int i, int j) { return j == i; } }; class MulMoreThan { int v原创 2013-03-27 09:05:39 · 587 阅读 · 0 评论 -
STL删除元素
//Removing.cpp #include #include #include #include "Generators.h" #include "PrintSequence.h" using namespace std; struct isUpper { bool operator()(char c) { return isupper(c); } }; int main(原创 2013-03-27 13:25:00 · 640 阅读 · 0 评论 -
STL在已排序的序列上进行集合运算
//SetOperations.cpp #include #include #include "Generators.h" #include "PrintSequence.h" using namespace std; int main() { const int SZ = 30; char v[SZ + 1], v2[SZ + 1]; CharGen g; generate(v,原创 2013-03-27 16:23:35 · 661 阅读 · 0 评论 -
STL合并已排序的序列
//MergeTest.cpp #include #include "PrintSequence.h" #include "Generators.h" using namespace std; //使用以下方法必须是已排序的序列 int main() { const int SZ = 15; int a[SZ * 2] = {0}; generate(a, a + SZ, SkipGen原创 2013-03-27 15:45:14 · 694 阅读 · 0 评论 -
STL比较范围(equal, lexicographical_compare, mismatch)
#include #include #include #include #include "PrintSequence.h" using namespace std; int main() { string s1("This is a test"); string s2("This is a Test"); cout << "s1 = " << s1 << endl; cou原创 2013-03-27 09:49:40 · 976 阅读 · 0 评论 -
STL对已排序的序列进行排序和运算
[+] 西方有句谚语:不要重复发明轮子! STL几乎封装了所有的数据结构中的算法,从链表到队列,从向量到堆栈,对hash到二叉树,从搜索到排序,从增加到删除......可以说,如果你理解了STL,你会发现你已不用拘泥于算法本身,从而站在巨人的肩膀上去考虑更高级的应用。 排序是最广泛的算法之一,本文详细介绍了STL中不同排序算法的用法和区别。 1 STL提供的转载 2013-03-27 15:02:54 · 726 阅读 · 0 评论
分享