AES256-CBC
摘要:1、aes256cbc.h #ifndef _AES256CBC_H_ #define _AES256CBC_H_ #define AES_BLOCKLEN 16 #define AES_KEYLEN 32 #define AES_keyExpSize 240 struct AES_ctx { un
阅读全文
单例模式
摘要:注:主要看思想,windows下好像不能编译。
阅读全文
自定义String
摘要:class String { private: char* m_str; public: String(const char* str = NULL) { m_str = NULL; if(NULL == str) return; int len = strlen(str); m_str = new char...
阅读全文
C++虚函数
摘要:C++虚函数工作原理:声明虚函数的类中会有一个隐藏变量(所以会多4个字节),主要指向虚函数地址的表。如果子类没有重写父类的虚函数,子类中的虚函数地址表中该虚函数地址跟父类一样,如果重写了父类的虚函数,则该虚函数地址则为新的。如果一个函数没有申明为虚函数,编译器会进行静态联编,如果改行申明为虚函数,编
阅读全文
字典树模板
摘要:hdu2846该题字典树,在插入是把字符串分解成0到1到len的字符串后在插入。该题编译器需要选择C++,如果选择G++,内存过不了。笔者就是入了编译器的坑,浪费了半天时间在优化内存,结果发现C++编译器后直接就AC了。 #include<iostream> #include<cstdio> #in
阅读全文
STL之queue
摘要:queue常用方法有:front,size,empty,pop,push。 需要注意的是queue没有迭代器。所以需要遍历的时候只能使用pop与front来实现。 优先队列 priority_queue<int,vector<int>,greater<int> > q;
阅读全文
STL之vector篇
摘要:#include<iostream> #include<cstdio> #include<cstring> #include<vector> #include<algorithm> using namespace std; bool comp(const int& a,const int& b) {
阅读全文
STL之string篇
摘要:常用代码整理: #include<iostream> #include<cstdio> #include<cstring> #include<string> using namespace std; bool startWith(const string &str,const char* prex)
阅读全文
STL之map篇
摘要:度熊所居住的 D 国,是一个完全尊重人权的国度。以至于这个国家的所有人命名自己的名字都非常奇怪。一个人的名字由若干个字符组成,同样的,这些字符的全排列的结果中的每一个字符串,也都是这个人的名字。例如,如果一个人名字是 ACM,那么 AMC, CAM, MAC, MCA, 等也都是这个人的名字。在这个
阅读全文