STL
文章平均质量分 85
badgre
这个作者很懒,什么都没留下…
展开
-
STL::unordered_map(无序map)
C++的map是重载了"class templateunordered_map template < class Key, //unordered_map::key_type key类型 class T, //原创 2016-11-28 17:43:11 · 210 阅读 · 0 评论 -
用哈希表实现简陋的无序set
#include #include #include #include using namespace std;const int hash_prime_num = 15;const unsigned int _stl_prime[] = { 2, 5, 11, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 122原创 2016-11-30 22:38:15 · 211 阅读 · 0 评论 -
STL_迭代器_不可变长度数组类
#include using namespace std;templateclass Arry{T *p;const int length;public:Arry(int _n):length(_n){ p =new T[length];}T* begin(){ return p;}T* end(){ return p+length;}int size()原创 2016-11-18 21:08:26 · 127 阅读 · 0 评论 -
STL_迭代器_单向链表
#include #include #include using namespace std;templateclass List{public: struct node{ T data; node* next; node(){ next = NULL;} }; node *head, *tail; List(){ head = new node, tail = N原创 2016-11-19 10:00:22 · 163 阅读 · 0 评论 -
哈希集合
#include #include #include #include using namespace std;const int hash_prime_num = 15;const unsigned int _stl_prime[] = { 2, 5, 11, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 122原创 2016-12-01 16:52:20 · 240 阅读 · 0 评论 -
STL_迭代器_简单双向链表
#include #include using namespace std;templateclass List{public: struct node{ T data; node(){ next = prior = NULL;} node *next, *prior; };private: node *head,原创 2016-11-19 20:40:05 · 142 阅读 · 0 评论 -
STL_简易pair与trio
pair:该数据结构里有两种数据类型trio:该数据结构里有三种数据类型test.cpp如下#include #include #include "utility.h"using namespace std;typedef PairPair_ic;typedef TrioTrio_iic;Pair_ic p0;Trio_iic t0;class Int{ in原创 2016-11-20 11:55:54 · 173 阅读 · 0 评论