随笔分类 -  C++基础

摘要:先上代码 event_poll.h(代码不多,就不分cpp了) #pragma once #include <assert.h> #include <memory.h> #include <sys/epoll.h> #include <unistd.h> #include <algorithm> # 阅读全文
posted @ 2022-07-06 18:01 永驻的青春 阅读(989) 评论(0) 推荐(0)
摘要:线程池代码(代码太少了就不分cpp/h了): 1 #include <condition_variable> 2 #include <deque> 3 #include <iostream> 4 #include <mutex> 5 #include <thread> 6 7 class Threa 阅读全文
posted @ 2022-06-17 15:44 永驻的青春 阅读(61) 评论(0) 推荐(0)
摘要:代码: 1 #include "stdio.h" 2 #include <iostream> 3 #include <thread> 4 #include <vector> 5 6 //回调函数类 7 class MsgDeal 8 { 9 public: 10 MsgDeal() : value_ 阅读全文
posted @ 2021-07-30 13:33 永驻的青春 阅读(52) 评论(0) 推荐(0)
摘要:直接使用C++的sort函数获取的仅仅是数据的排列结果,当我们想要对应序号的排序结果呢? 获取数据对应序号的排序结果的思路是:首先产生序号数组,然后在排序时排列序号数组,判断的是序号对应的数据大小。代码如下 1 vector<int> vData(10); //数据 2 vector<int> vI 阅读全文
posted @ 2020-07-07 16:53 永驻的青春 阅读(3783) 评论(0) 推荐(0)
摘要:windows下获取文件夹下的所有文件名 1 #include "folder.hpp" 2 #include <io.h> 3 4 void getFilesFromFolder(const string strpath,vector<string> &vFile,const string str 阅读全文
posted @ 2020-05-27 14:44 永驻的青春 阅读(2113) 评论(0) 推荐(0)