摘要: https://kimi.moonshot.cn/share/cqaca783r07f8tq3lheg #include <sys/uio.h> #include <unistd.h> #include <errno.h> // 调整iovec数组,使其指向未写入的数据部分 void adjust_ 阅读全文
posted @ 2024-07-15 14:44 joel-q 阅读(3) 评论(0) 推荐(0) 编辑
摘要: https://kimi.moonshot.cn/share/cqaberkdvond1bljn8sg 在这个示例中: 线程池创建了固定数量的工作线程。 enqueue 方法用于将任务添加到队列,并返回一个 std::future 对象,可用于获取任务的结果。 每个工作线程在循环中等待任务分配,并在 阅读全文
posted @ 2024-07-15 14:37 joel-q 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 在内置类型中定义operator i_uintptr_t()可以实现对内置类型与内置指针类型之间的转换,即做取内置类型地址的操作。 #include <iostream> struct i_uintptr_t { i_uintptr_t(): ptr{} {} i_uintptr_t(uintptr 阅读全文
posted @ 2024-06-21 10:07 joel-q 阅读(1) 评论(0) 推荐(0) 编辑
摘要: Bison The Yacc-compatible Parser Generator 10 September 2021, Bison Version 3.8.1 by Charles Donnelly and Richard Stallman 目录Bison1 The Concepts of Bi 阅读全文
posted @ 2024-06-12 20:18 joel-q 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 98. 验证二叉搜索树 递归 class Solution { TreeNode *leftMost; TreeNode *rightMost; bool limitYourself(TreeNode *root, int min, int max) { if (root == nullptr) { 阅读全文
posted @ 2024-03-13 21:54 joel-q 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 小白debug 阅读全文
posted @ 2024-03-12 16:03 joel-q 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1. 两数之和 space: \(O(n)\) time: \(O(n)\) class Solution { using index = pair<int, int>; static bool compare(index a, index b) { return a.second < b.seco 阅读全文
posted @ 2024-03-11 23:57 joel-q 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 20. 有效的括号 std::stack<T>的几个方法: top:相当于back pop:相当于pop_back push: 相当于push_back class Solution { public: static char leftOf(char c) { switch (c) { case ' 阅读全文
posted @ 2024-03-09 17:31 joel-q 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 三分学 七分练 leetcode 21 合并两个有序链表 尾插法 头结点 #include <iostream> using namespace std; struct ListNode { int val; ListNode *next; ListNode() : val(0), next(nul 阅读全文
posted @ 2024-03-07 21:26 joel-q 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 收集一些不错的学习资料 cmake实战入门 PROJECT(HELLO)生成工程名 ADD_EXECUTABLE(hello main.cpp)以右侧参数生成左侧目标参数 ADD_SUBDIRECTORY(src bin)将左侧子目录下生成的目标移动到bin目录下 安装 CMAKE_INSTALL_ 阅读全文
posted @ 2023-02-11 14:47 joel-q 阅读(27) 评论(0) 推荐(0) 编辑