
C++STL
文章平均质量分 72
FanTasyCC
这个作者很懒,什么都没留下…
展开
-
C++中的标准函数对象
函数对象函数对象是一种利用句法规则特定设计的类生成的对象,它的作用类似于函数。在C++中,这是通过在类中定义成员函数operator()实现的,举个例子:struct myclass { int operator()(int a) {return a;}}myobject;int x = myobject(0);它们作为断定或者比较功能和标准算法(algo翻译 2008-12-15 23:50:00 · 3112 阅读 · 1 评论 -
list使用
// listTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include using namespace std;/* 对元素的要求: 1.拷贝构造函数 2.赋值运算 3.构造函数 4.<运算(sort会用到原创 2010-02-26 20:15:00 · 759 阅读 · 0 评论 -
vector使用
// vectorTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include #include using namespace std;class TestEle{public: TestEle(int nCnt,原创 2010-02-26 14:08:00 · 981 阅读 · 0 评论 -
deque使用
// dequeTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include using namespace std; /* 双端队列 */ /原创 2010-03-04 11:04:00 · 1421 阅读 · 0 评论 -
priority_queue使用
// priority_queueTest.cpp : Defines the entry point for the console application.// #include "stdafx.h"#include #include using namespace std;/*template class Compare = less > class p原创 2010-03-05 17:17:00 · 1042 阅读 · 0 评论 -
map使用
// mapTest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include #include using namespace std;/*template ,class Allocator = allocator > > class map;原创 2010-03-05 21:24:00 · 1269 阅读 · 0 评论 -
stack使用
// stackTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include #include using namespace std; /* stack是一个后进先出操作元素原创 2010-03-09 17:12:00 · 1948 阅读 · 0 评论 -
利用vector分配动态内存
<br />// vectorTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <vector> using namespace std; int ComputeSize(void); //计算需要的内存大小 int ComputeSize(void) { int nRet = 500; return nRet; } int _tmain(原创 2010-07-14 12:40:00 · 3077 阅读 · 0 评论