
BOOST/STL
codinglf
专注于视频直播行业,在这个行业基类了丰富的经验,热爱开源项目。
我坚信业精于勤,只有偏执狂才能真正的成功。
喜爱的开源项目有:ffmpeg、opencv、crtmpserver、obs-studio、nginx、redis、skynet、kbengine、protobuf等等。。。
我的博客:http://blog.youkuaiyun.com/windows_nt
展开
-
STL标准模板库实例
/**list事例程序*/#include #include using namespace std;int main(){ list coll; for (char c = 'a'; c { coll.push_back(c); } while(!coll.empty()) { cout原创 2012-04-01 18:46:13 · 860 阅读 · 0 评论 -
STL源码剖析学习之基本算法
//STL之基本算法//学习目的:学习基本算法的使用/*//本程序代码来源《STL源码剖析》*///file:6algobase.cpp#include #include #include #include #include #include using namespace std;templatestruct display原创 2013-02-15 14:03:22 · 1097 阅读 · 0 评论 -
STL源码剖析学习之容器
//STL之容器//学习目的:各个容器的使用。/*容器分为:序列式容器和关联式容器。序列式容器:array, vector, list, deque关联式容器:set, map, multiset, multimapvector的数据安排以及操作方式,与array非常相似两者唯一的差别在于,array是静态空间,一旦配置了就不能改变,想要扩充,一切琐碎得由客户端自己来:首先原创 2013-02-15 09:43:49 · 1598 阅读 · 0 评论 -
STL源码剖析学习之increment、decrement、dereference实现源码
//STL之increment、decrement、dereference实现源码//学习目的:STL实现原理、操作符(++i,i++,*等操作符的重载)//increment/dereference操作符在迭代器的实现上占有非常重要的地位,因为任何一个迭代器都必须实现出前进(increment,operation++)和取值(dereference,operation*)功能。//本原创 2013-02-15 09:37:39 · 1410 阅读 · 0 评论 -
标准模版库学习之关联式容器
setstd::set iset;std::set::iterator it = iset.insert(4).first;(*it)++; // error. 原因:std::set的迭代器不能修改对应的元素. //语法上不会报错,程序中也可以修改,但会破坏有序性,set可能表现出非预期的行为这是因为:std::set的特点是:1. 对于插入、删原创 2013-03-03 16:48:13 · 1130 阅读 · 0 评论 -
STL源码剖析学习之function call操作符(operator())
//STL之function call操作符(operator())//学习目的:函数指针与仿函数、operator()重载/*函数指针有缺点,最重要的是它无法持有自己的状态(所谓局部状态,local states),也无法达到组件技术中的可适配性(adaptability)----也就是无法再将某些修饰条件加诸于其上而改变其状态。为此STL使用了仿函数,所谓仿函数就是使用起来原创 2013-02-15 09:42:06 · 1878 阅读 · 0 评论 -
标准模版库学习之序列式容器
vector/**目的:学习vector容器的使用。*程序输出:hello, how are you ?max_size(): 134217727size(): 5capacity(): 5hello, you are how always ! max_size(): 134217727size(): 6capacity原创 2013-03-03 16:44:19 · 989 阅读 · 0 评论 -
由accumulate()扩展出来的一系列方法
由accumulate()扩展出来的一系列方法 默认情况下,accumulate()函数将operator+操作应用到容器中所有元素,然后返回这些元素相加的累积结果。对于整数集合来说,如果提供给accumulate()函数的初始值为0,那么该函数返回的结果就是集合中所有元素的和。accumulate()函数不仅可以进行对象相加,而且可以对容器元素进行任何操作(前提是元素支持这种操作),原创 2012-12-14 14:17:20 · 1726 阅读 · 0 评论 -
STL之函数对象事例
/* for_each()、transform、bind1st()函数的使用。 知识点: 如果STL函数需要一个一元函数,而现有一个能完成相应工作的自适应二元函数,则 可以使用bind1st()或bind2nd使该二元函数适用于一元接口。 程序输出: gr8: 36 39 42 45 48 m8: 25 27 29 31 33 sum: 61 6原创 2012-10-16 10:25:19 · 836 阅读 · 0 评论 -
STL之迭代器事例三
/* 联合容器multimap事例,用multimap存储城市区号和名称。 知识点: 联合容器,set容器值的类型与关键字相同,map容器值的类型与关键字不同,关键字都是唯一的。 multimap容器与map相似,只是一个关键字可以与多个值关联。 程序输出: Number of cities with area code 415:2 Number of cities w原创 2012-10-15 20:48:11 · 982 阅读 · 0 评论 -
STL之迭代器事例二
/* 输入输出,正反迭代器的使用; 程序输出: Let the dice be cast! 6 7 4 5 2 6 7 10 16 5 Implicit use of reverse iterator. 5 16 10 7 6 2 5 4 7 6 Explicit use of reverse iterator. 5 16 10 7 6 2 5 4 7 6 */原创 2012-10-10 18:59:03 · 996 阅读 · 0 评论 -
STL之迭代器事例一
/* 迭代器转逆向迭代器事例程序* - 程序输出:1 2 3 4 5 6 7 8 9pos: 5rpos: 4*/#include #include #include using namespace std;int main(){ vector coll; for (int i = 1; i { coll.push_back(i);原创 2012-04-01 18:47:38 · 887 阅读 · 0 评论 -
STL之算法实例
//algostuff.hpp头文件,以下程序都用此头文件。/*********头文件开始**********/#ifndef ALGOSTUFF_HPP#define ALGOSTUFF_HPP#include #include #include #include #include #include #include #include #inclu原创 2012-05-04 17:54:03 · 1234 阅读 · 0 评论 -
STL源码剖析学习之数值算法
//STL之数值算法//学习目的:学习数值算法的使用/*根据迭代器increment(累加)特性,迭代器可以分为5累。每一个STL算法的声明,都表现出它所需要的最低程度的迭代器类型。例如:find()需要一个inputiterator,这是它的最低要求,但它可以接受更高类型的迭代器,如forwarditerator。将无效的迭代器传给某个算法,虽然是一种错误,却不保证能够在编译原创 2013-02-15 13:02:52 · 955 阅读 · 0 评论