随笔分类 - C++
摘要:Code-C++-regex C++ 正则表达式 regex #include <regex> std::regex; std::smatch; regex_replace();
阅读全文
摘要:Code-C++-字符串分割 转自【C++中string如何实现字符串分割函数split()——4种方法 - CSDN App】http://t.csdnimg.cn/8iWb7 stringstream getline() string find() substr() c char strtok(
阅读全文
摘要:Code-C++-Snowflake #include <iostream> #include <chrono> #include <stdexcept> class Snowflake { private: // 雪花算法的各个参数 static constexpr int64_t workerI
阅读全文
摘要:# C++-生成UML类图 ## 可以用doxygen根据代码生成文档 1. 安装 - `sudo apt install graphviz` # 用于生成代码关系图 - https://graphviz.org/ - `sudo apt install doxygen` - www.doxygen
阅读全文
摘要:# Book-Effective C++ 改善程序与设计的55个具体做法 1. 让自己习惯C++ Accustoming Yourself to C++ - 条款 01:视 C++ 为一个语言联邦/View C++ as a federation of languages. - 条款 02:尽量以`
阅读全文
摘要:# C++-mutex(待验证) 在使用std::mutex时,应该声明为全局或者类的静态成员变量。 ``` class A { public: void f(); public: static std::mutex m_Mutex; } std::mutex _mu; void A:f() { s
阅读全文
摘要:# Tool-Static Analyzers-C++ ## C++ Code Style ### Google styleguide >https://google.github.io/styleguide/ 包含cpplint #### Google styleguide cppguide >h
阅读全文
摘要:# C++-double free or corruption(fasttop) 出现double free or corruption(fasttop) 检查: 1. delete,是否有重复delete 2. 隐式的复制构造函数导致析构次数增加 3. 全局变量,项目代码合并时,不同的共享库中出现
阅读全文
摘要:# C++-Class-Util & Helper >https://zhuanlan.zhihu.com/p/352749160 >https://www.cnblogs.com/ligiggy/p/15320192.html ``` A Utility class is understood t
阅读全文
摘要:# Book-深度探索C++对象模型 ## 序章 对象模型是深层结构的知识,关系到“与语言无关、与平台无关、跨网络可执行”软件组件(software component)的基础原理。也因此,了解C++对象模型,是学习目前软件组件三大规格(COM、CORBA、SOM)的技术基础。 如果你对软件组件(s
阅读全文
摘要:# C++-const成员函数 const成员函数 函数不会修改类对象 用于声明不会对其隐式访问的对象进行修改的函数 原型和定义后显示声明const
阅读全文
摘要:C++-shared_ptr #include <iostream> #include <memory> #include <vector> class A { public: A(){ std::cout<<"A cc."<<std::endl; }; ~A(){ std::cout<<"A dd
阅读全文
摘要:C++-typeid-操作符 基类指针 typeid可以进行类型判断 对于基类指针时: typeid(*pointerBaseClass) == typeid(DerivedClassName) typeid是操作符,不是函数! 在c++中,typeid用于返回指针或引用所指对象的实际类型。 运行时
阅读全文
摘要:# C++ Primer Plus (第六版) 中文版(部分章节) ### Bjarne Stroustrup's homepage! Bjarne Stroustrup's homepage! https://www.stroustrup.com/ ### 编译和链接 UNIX编译和链接 cc c
阅读全文
摘要:C++-std::this_thread::get_id()-获取线程id std::this_thread::get_id() 头文件:<thread> 函数:std::this_thread::get_id() 用例:std::thread::id thread_id = std::this_t
阅读全文
摘要:C++-#pargma once https://baike.baidu.com/item/%23pragma%20once/9468158?fr=aladdin #pragma once是一个比较常用的C/C++预处理指令。 只在头文件的最开始加入这条预处理指令,就能够保证头文件只被编译一次。 基
阅读全文
摘要:C++-改变终端(cout/printf)输出不同颜色的字体-Linux https://blog.csdn.net/qq_41972382/article/details/90311102 不同颜色的输出主要依据格式ESC[*m,ESC的八进制为\033,*可以是多个属性的组合,用,隔开。 pri
阅读全文
摘要:C++-标准异常<exception> std::exception 定义于头文件 <exception> class exception; https://www.apiref.com/cpp-zh/cpp/error/exception.html 标准库头文件 <stdexcept> https
阅读全文
摘要:#C++-template class-模板类 【C++高级教程,C++类模板一次讲透,必须收藏!】 https://www.bilibili.com/video/BV1v84y1x7Qp/?share_source=copy_web&vd_source=3809390a14c335e7731c9e
阅读全文
摘要:#Code-C++-Linux-统计一个文件夹占据空间大小 https://my.oschina.net/Tsybius2014/blog/330628 从以上链接中拷贝的代码 #include <stdio.h> #include <sys/stat.h> #include <sys/types.
阅读全文