![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
804052545@qq.com
你好
展开
-
C++ 比较浮点型数据(float,double)
学习来源:C++Lernbool approximatelyEqualAbsRel(double a, double b, double absEpsilon, double relEpsilon){ // Check if the numbers are really close -- needed when comparing numbers near zero. double diff{ std::abs(a - b) }; if (diff <= absEpsilon) re原创 2021-01-25 16:01:59 · 289 阅读 · 0 评论 -
C++ 获取系统时间(微秒)
int main(){ //程序开始时间 std::chrono::time_point<std::chrono::high_resolution_clock> t0 = std::chrono::high_resolution_clock::now(); for (size_t i = 0; i < 100; i++) { std::cout << i << std::endl; } //程序结束时间 std::chrono::time_.原创 2021-01-19 16:16:20 · 1431 阅读 · 0 评论 -
C++ lambda自定义map,set,vector,list 排序规则
Map和Set本质红黑二叉树,插入数据时可以自定义比较算法,list和vector链表插入时无需比较(所以一般全部插入完成后调用sort() )核心代码: typedef struct Student { std::string name; int grade; } Student; //Lambda设置map排序规则,同样适合于vector,list auto func = [](const Student* left, const Student* right) { ret原创 2021-01-18 19:22:57 · 3249 阅读 · 0 评论 -
C++ 分割字符串(包括含有连续分隔符)
C++ 分割字符串(包括含有连续分隔符)网上很多教程都是分割字符串,但是不能正确分割含有连续分隔符得字符串,比如分割:" I u0 fdfsdf fdsdaas q.qwwqe 3213 3213 ^^ ^ ",里面有多个连续空格,正确分割后如下:std::vector<std::string> splitString(const std::string str, const char chrc){ std::vector<std::stri...原创 2021-01-13 18:00:32 · 970 阅读 · 0 评论 -
C++内存简化模型
学习记录下,很不错的C++学习教程:https://www.icourse163.org/learn/BUPT-1003564002?tid=1450339466#/learn/content?type=detail&id=1214630906&cid=1218578844原创 2020-05-26 23:33:53 · 175 阅读 · 0 评论