- 博客(7)
- 收藏
- 关注
原创 常用的一些排序方法
//选择排序template<class T>void SelectSort(T *pData,size_t size,bool IsUp=true){ T swap; if (IsUp) { for (size_t i = 0; i < size - 1; ++i) { for (size_t j = i + 1; j < size; ++j) { if (pData[i]>pData[j]) { swap = pD.
2021-11-24 23:11:15 205
原创 vector(栈)的一些常用方法实现
#ifndef MYVECTOR_H#define MYVECTOR_H#define SAFE_DELARR(p) {if(p){delete []p;p=nullptr;}}template<class T>class myvector{public: myvector() { m_pData = nullptr; m_DataNum = 0; m_Capacity = 0; } myvector(size_t count) { if (count.
2021-11-22 21:16:01 668
原创 链式哈希表的实现
#ifndef SAFE_DELETE#define SAFE_DELETE(p) {if(p) {delete p;p=nullptr;}}#endif#ifndef SAFE_DELARR#define SAFE_DELARR(p) {if(p) {delete []p;p=nullptr;}}#endiftemplate<class H,size_t TableSize>class HashTable_StringKey{public:struct Node{.
2021-11-22 17:18:27 262
原创 顺序树的一些常用方法实现
#ifndef SAFE_DELARR#define SAFE_DELARR(p) {if(p){delete []p;p=nullptr;}}#endifenum TRAVERSEKIND{ TK_FRONT, TK_MID, TK_END};template<class T>class arraytree{public:arraytree(){ m_pData=nullptr; m_DataNum=0; m_Capacity=0;}void .
2021-11-19 11:04:52 293
原创 单例模式 以及友元单例模式
//SingleClass.hclass SingleClass{private:SingleClass();~SingleClass();public:static SingleClass *Create();static void Release();protected:static SingleClass *g_pInstance;staic size_t g_Ref;};//SingleClass.cppSingleClass *SingleClass::g_pIns.
2021-11-18 21:54:53 3092
原创 MyString 四个必须具备的函数 无参构造 拷贝构造 赋值 析构
class mystring{public:mystring(){ m_pstr=nullptr;}mystring(mystring const &other){ if(other.m_pstr) { int sl=strlen(other.m_pstr); m_pstr=new char[sl + 1]; strcpy_s(m_pstr, sl+1, other.m_pstr); } else { m...
2021-11-18 21:31:42 234
原创 memory系列与String系列函数
void *mymemcpy(void * const dest,void * const * const src,size_t count){ unsigned char * const pdest = (unsigned char * const)dest; unsigned char const * const psrc = (unsigned char const * const)src; if(pdest != psrc) { .
2021-11-18 21:19:04 1169 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人