Linux 内核中 C 语言的面向对象2025-02-21cpp1070 words 3 mins readLinux 内核使用 结构体 和 函数指针 的组合模拟面向对象(OO)编程范式。 1. 结构体封装数据与行为 数据抽象:将相关属性和状态封装在一个 struct 中。 行为绑定:通过Read more...
web 访问认证机制2025-02-17web1671 words 4 mins read25 | 认证机制:应用程序如何进行访问认证?讲得非常好,图文结合。 IAM:身份识别与访问管理(Identity and Access Management)。 认证(Read more...
扫描线算法计算区间重叠2025-02-15cpp948 words 2 mins read题目来源:Marscode。 小C和小U有一个从0开始的数组nums,以及一个非负整数k。每次操作中,小C可以选择一个尚未选择的下标i(范围在Read more...
C++ 同一进程的线程之间共享哪些资源?2025-02-08cpp404 words 1 min read同一进程内的线程共享的资源: 代码段:存放程序的可执行指令,所有线程共享相同的代码段,因此任何线程都可以执行程序中的函数。 数据段:包含全局变量Read more...
运行时是把整个动态库都加载到内存中吗?2025-02-08cpp363 words 1 min read在 C++ 中,动态库(如 .dll 或 .so 文件)在加载时,操作系统会将整个库文件映射到进程的地址空间中。 具体的函数和数据只有在被实际使用时才会被加载到内存中。Read more...
检查字符串是否是另一个的子串2025-01-29cpp1305 words 3 mins read常见 C/C++ API std::string的 string::find 成员函数 1 2 3 4 5 6 #include <string> using namespace std; bool isSubstring(const string& mainStr, const string& subStr) { return mainStr.find(subStr) != string::npos; } 大多数标准库的 strstr(如Glibc)和 strRead more...
写个相对现代的 C++ 二叉搜索树2025-01-21cpp950 words 2 mins read1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70Read more...
C++ std::function 之脱裤子放屁的优化2025-01-15cpp1331 words 3 mins read看到一句话: std::function 很强大,但是代价也很高,在创建函数对象的时候总是会有 new 操作的。虽然通常情况下影响不是很高,但是总觉得这是没必要的。 于是草草找一Read more...
在 C++ 里实现 Golang 的 defer2025-01-15cpp529 words 2 mins read利用 RAII 和 C++ 的析构函数。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59Read more...
[转载] C++的POD以及如何判断是否POD2025-01-09cpp1101 words 3 mins readC++的POD以及如何判断是否POD - cheeto的文章 - 知乎。 在C++11及以后的版本中,POD类型(Plain Old Data)的定义被细化为Read more...