会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
花花公子1234
博客园
首页
新随笔
联系
订阅
管理
2023年7月3日
c++实现多线程消息通信队列
摘要: #ifndef _SYNC_SIMPLEQUEUE_QUEUE_HPP_ #define _SYNC_SIMPLEQUEUE_QUEUE_HPP_ #include <queue> using namespace std; namespace utility { #ifndef _SYNC_SIMP
阅读全文
posted @ 2023-07-03 10:45 花花公子1234
阅读(295)
评论(0)
推荐(0)
2023年5月11日
c++自定义工具类的定义和使用
摘要: class log_work { private: int log_id_ = 1; int log_level_; qnx_slog2() = default; virtual ~qnx_slog2() { uninit(); } public: inline static log_work& g
阅读全文
posted @ 2023-05-11 11:30 花花公子1234
阅读(194)
评论(0)
推荐(0)
c++模版多参数的递归用法--自定义log
摘要: #include <iostream> #include <sstream> #include <string> #include <tuple> #include <type_traits> template <typename T> void print_impl(std::ostringstr
阅读全文
posted @ 2023-05-11 11:08 花花公子1234
阅读(159)
评论(0)
推荐(0)
c++ define的几种用法
摘要: 1,编译宏做开关; #ifdef XXX ...; #else ...; #endif 2,自定义日志格式; #define FACEID_TRACE(log_str, ...)
阅读全文
posted @ 2023-05-11 10:29 花花公子1234
阅读(109)
评论(0)
推荐(0)
2023年5月10日
c++出现可能core的地方增加try{};
摘要: try { xxx core; } catch (std::exception & e) { printf("error is %s\n", e.what()); }
阅读全文
posted @ 2023-05-10 21:06 花花公子1234
阅读(81)
评论(0)
推荐(0)
2021年12月30日
字符串多模匹配---最左优先
摘要: #pragma once #include <string> #include <unordered_map> #include <vector> struct Node{ int fail; std::string change_word; std::string word; using Tran
阅读全文
posted @ 2021-12-30 15:49 花花公子1234
阅读(48)
评论(0)
推荐(0)
2021年7月20日
设计模式
摘要: 1,工厂模式 2,单例模式 不支持拷贝构造和operator = 接口 3,观察者模式 4,访问者模式;
阅读全文
posted @ 2021-07-20 09:23 花花公子1234
阅读(30)
评论(1)
推荐(0)
2021年7月19日
c++内存管理
摘要: (1)栈区 :函数内的临时变量; (2)堆区 :动态申请的内存,new; (3)全局区/静态区 : 全局变量和静态全局变量的存储方式是一样的,区别在于,全局变量在整个源代码中都可以使用,而静态全局变量只能在当前文件中有效(对于全局变量,加上 static 只是改变了变量的作用范围, 而对于某个局部静
阅读全文
posted @ 2021-07-19 14:53 花花公子1234
阅读(31)
评论(0)
推荐(0)
2021年7月12日
c++ sizeof()
摘要: 1. 不使用sizeof()计算机器位数; int* a[2]; int size = (char*)&a[1] - (char*)&a[0]; 2. 32位指针4字节,64位指针8字节; 编译器G++, 机器64位,经测试类中的数据会向最大的字节数看齐;例如: 1. class A{ char a
阅读全文
posted @ 2021-07-12 21:01 花花公子1234
阅读(56)
评论(0)
推荐(0)
2021年7月9日
分布式高可用,选主,同步,恢复流程
摘要: 1, 每一个节点都有三个状态:leader,follower,dead; 每一个集群在某一时间,只能有一个leader(否则会脑裂); 选主:leader会一直通过线程发送给follower消息;当某一个follower超过一定时间后没有收到消息,则向集群内发送成为主的请求,通过消息序号决定论次;
阅读全文
posted @ 2021-07-09 17:55 花花公子1234
阅读(50)
评论(0)
推荐(0)
下一页
公告