- 博客(10)
- 收藏
- 关注
原创 C++多态实现中的指针修正
昨天看了下耗子叔的c++虚函数表的实现,想起看《Inside_the_C++_Object_Model 》里指针修正的过程,做了下试验,发现将子类地址赋值给基类指针的过程中确实会将基类指针进行修正,谷歌上搜了搜没发现有中文博客涉及这个内容,就在这里做个记录吧。首先,先看懂这两篇关于虚函数表实现的文章 C++ 虚函数表解析 C++ 对象的内存布局 然后是《Inside_the_C++_Objec
2016-06-17 09:29:50
721
原创 raft论文阅读摘要
raft论文阅读摘要本文只是基本摘要,只能作为论文的辅助理解,要想真正弄懂raft还是得自己看论文,别人的理解和原文的意思总是有出入的,而且翻译的文章不可能完全符合英文本来的含义基础构架 本质上raft是对Replicated state machine进行同步的算法。为了提高可用性,由client发来的命令需要被复制到多个server节点上,raft解决的就是如何在网络分区,节点故障的情况下保证
2016-06-04 11:08:06
957
原创 disque基本流程介绍
disque基本流程介绍disque基础整个系统包括3个部分,生产者,disque集群,消费者,生产者将产生的消息(disque中称之为job)加入disque,然后被消费者取走,成功取得job后消费者会回复一个确认消息,基本的API和构架如下 ADDJOB queue_name job [TTL <sec>] queue_name:队列名 job:消息内容 TTL:失效时间,超过这
2016-05-29 20:08:12
1744
翻译 Redis Cluster Specification
Redis Cluster Specification简单的翻译了一下官方关于cluster的说明,算是做个笔记,前面比较好懂的几章就没翻译了,大约翻译了一半吧,顺便加入了自己的理解,redis中午站上那个翻译的实在不太好。 原文链接Fault Tolerance心跳和gossip协议(gossip挺有意思的,可以查下维基,用于无中心的分布式系统中关键的配置信息进行发布,比如有A,B,C,D四个节
2016-04-29 20:09:36
550
翻译 The binary search of distributed programming翻译
The binary search of distributed programming简单的说就是如何实现一种方法,使redis集群提供一个逐步增加(monotonically increasing)的ID值(一致性算法)这时候是个简单的问题,但实际上要复杂的多,考虑到在任何情况下,都必须保证如下特性:产生的新的ID要比所有以往的id大,在不同的时刻不能产生不同的ID,而且考虑网络分区(netwo
2016-04-28 09:54:22
382
原创 hdu 2487 一道水题,ugly windows 写的相当乱
发现模拟题总是写的很凌乱,想到哪写到哪,写的最后发现有问题打补丁打的乱七八糟,题目很水,我的方法是扫描到窗口的最上一行记下他的起始位置和结束位置,继续往下扫描,若是完整的窗口,中间每行都是X。。。。。X的形式,最后一行是xxxxx的形式,有个小trick,窗口嵌套要算里面的。#include #include#include using namespace std;char scr
2012-05-20 11:07:47
773
原创 poj 4048 wa了n次 印象深刻
#include#include #include #include #include #define max 5000using namespace std;const double eps = 1e-8;struct point{double x,y;};struct line {point a,b;};line L[max];point base;int T,N;b
2012-05-14 21:32:24
733
原创 poj 1279 第一道半角平面
#include #include #include #include #include #include #include #include #include #include using namespace std;const int MAX = 1510;struct point{ double x,y;};point p[MAX],s[MAX];const
2012-05-07 12:48:30
623
原创 poj1113 第一道凸包,一次a
#include #include#include#include using namespace std;const double pi=acos(-1.0);const double eps=1E-9;typedef struct{ double x,y;} Point;Point point[1100];Point ch[1100];in
2012-05-04 15:50:07
573
原创 poj1696 ,第一次用泛型
#include#include#include #include using namespace std;typedef struct{int x,y,index;}Point;Point Base;Point point[100];int m,n;int Det(int x1,int y1,int x2,int y2){retur
2012-05-01 16:05:14
656
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人