摘要: 使用std::thread 创建线程, 代码逻辑如果存在某些异常,。这时候程序会产生coredump, 但是分析coredump, 会发现调用栈是缺失的,造成定位问题困难; 问题描述: 源码: 1 #include <stdexcept> 2 #include <thread> 3 #include 阅读全文
posted @ 2022-12-13 17:15 郭流水 阅读(412) 评论(0) 推荐(0) 编辑
摘要: 转自: http://www.cppblog.com/zgysx/archive/2007/03/12/19662.html C++中的重载(Overload), 覆盖(Override)和隐藏(Hide)写正题之前,先给出几个关键字的中英文对照,重载(overload),覆盖(override), 阅读全文
posted @ 2022-03-28 10:29 郭流水 阅读(371) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<errno.h> 5 #include<sys/types.h> 6 #include<sys/socket.h> 7 #include<unistd.h 阅读全文
posted @ 2020-08-05 18:46 郭流水 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 在编写代码的时候,发现一个现象: 模板类从一个父模板类继承后,不能访问其内部的protected成员变量,提示:not declare; 普通类从一个父模板类继承后,可以访问其内部的protected成员变量,可正常编译和使用; 对于第1个现象,如果想正常使用需要加上父模板类的域名; 下面上代码 模 阅读全文
posted @ 2020-04-26 10:44 郭流水 阅读(1046) 评论(1) 推荐(0) 编辑
摘要: 先上图 阅读全文
posted @ 2020-04-08 10:10 郭流水 阅读(602) 评论(0) 推荐(0) 编辑
摘要: xx.cpp中包含头文件的次序如下: xx.h C 系统文件 C++ 系统文件 其他库的 .h 文件 本项目内 .h 文件 阅读全文
posted @ 2020-04-07 10:15 郭流水 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 1) brpc/channel.cpp int Channel::Init(const char* ns_url, const char* lb_name, const ChannelOptions* options) 2) brpc/load_balancer_with_naming.cpp in 阅读全文
posted @ 2020-02-11 20:48 郭流水 阅读(569) 评论(0) 推荐(0) 编辑
摘要: 1,error: template declaration of 'typedef' typedef std::function<void(Input begin> My_Func 解决方案: template <typename Input> using My_Func= std::functio 阅读全文
posted @ 2020-02-11 15:49 郭流水 阅读(1012) 评论(0) 推荐(0) 编辑
摘要: 1,装饰模式 2,观察者模式(发布/订阅) 未完待续 阅读全文
posted @ 2020-02-10 22:45 郭流水 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 装饰模式定义:装饰模式动态的将责任附加到对象上,若要扩展功能,装饰模式提供了比继承更有弹性的替代方案。 以大话设计模式中的例子来描述,1,找出概念装饰对象:人,(中国人,美国人等)装饰器:鞋子、裤子、帽子、外套 2,既然要使用鞋子、裤子等装饰一个对象:人,则为穿了鞋子的人、穿了裤子的人、戴了帽子的人 阅读全文
posted @ 2020-02-10 22:15 郭流水 阅读(147) 评论(0) 推荐(0) 编辑