摘要: 在C++中,四种类型转换(cast)方式——static_cast、dynamic_cast、const_cast 和 reinterpret_cast——提供了不同的类型转换机制,每种都有其特定的适用场景、语义和限制。以下是对这四种cast的详细说明,包括它们的用途、实现机制、适用场景、注意事项以 阅读全文
posted @ 2025-06-03 10:50 紫川Bin 阅读(178) 评论(0) 推荐(0)
摘要: 全排列: #include <vector> #include <algorithm> #include <iostream> void permute(std::vector<int>& nums, int start, std::vector<std::vector<int>>& result) 阅读全文
posted @ 2025-05-23 21:12 紫川Bin 阅读(42) 评论(0) 推荐(0)
摘要: 先上代码: #include <thread> #include <condition_variable> #include <mutex> #include <iostream> using namespace std; int main() { mutex mtx; condition_vari 阅读全文
posted @ 2025-05-23 20:43 紫川Bin 阅读(13) 评论(0) 推荐(0)
摘要: 使用基础的 C++代码实现一个并查集 (Disjoint Set Union, DSU),有时也称为 Union-Find 数据结构。 并查集主要支持两种操作: find(i): 查找元素 i 所在的集合的代表元(通常是树的根节点)。 unite(i, j) (或 union_sets(i, j)) 阅读全文
posted @ 2025-05-20 10:35 紫川Bin 阅读(335) 评论(0) 推荐(0)
摘要: std::next_permutation 是 C++ STL 中 头文件里的一个非常有用的函数,它可以将序列(比如 std::vector 或 std::string 中的元素)重新排列为字典序上的下一个更大排列。如果当前排列已经是字典序最大的了,它会将序列变为字典序最小的排列(即排序后的状态), 阅读全文
posted @ 2025-05-19 22:13 紫川Bin 阅读(202) 评论(0) 推荐(0)
摘要: 最近在做Openwifi的组网实验,连接openwifi的开发板用的电脑有两网卡ip分别在192.168.30,和192.168.10网段,而openwifi的以太网ip为192.168.10.122,但是wifi所分配的网段为192.168.13。 目前电脑可以连接到公网,也可以通过192.168 阅读全文
posted @ 2025-03-27 18:49 紫川Bin 阅读(1432) 评论(0) 推荐(0)