随笔分类 -  c++代码练习

上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 46 下一页

leveldb 学习记录(二) Slice
摘要:基本每个KV库都有一个简洁的字符串管理类 比如redis的sds 比如leveldb的slice 管理一个字符串指针和数据长度 通过对字符串指针 长度的管理实现一般的创建 判断是否为空 获取第N个位置元素等管理 还可以进行字符串裁剪等操作 避免了一些复制拷贝的消耗性能的操作。 class Slice 阅读全文

posted @ 2017-10-24 10:03 itdef 阅读(312) 评论(0) 推荐(0)

leveldb 学习记录(一) skiplist
摘要:leveldb LevelDb是一个持久化存储的KV系统,并非完全将数据放置于内存中,部分数据也会存储到磁盘上。 想了解这个由谷歌大神编写的经典项目. 可以从数据结构以及数据结构的处理下手,也可以从示例的某一点深入跟进系统,查看处理流程. windows下编译leveldb 地址 leveldb 源 阅读全文

posted @ 2017-10-23 15:42 itdef 阅读(607) 评论(0) 推荐(0)

代码分析资料搜集
摘要:// 数据分析与处理之二(Leveldb 实现原理) 【LevelDB源码剖析系列】SkipList与Memtable LevelDB Cache实现机制分析 从朴素解释出发解释leveldb的设计 LevelDB原理探究与代码分析 LevelDB原理探究与代码分析(上) LevelDB原理探究和代 阅读全文

posted @ 2017-10-23 11:56 itdef 阅读(435) 评论(0) 推荐(0)

rapidjson 的练习
摘要:运行截图: 阅读全文

posted @ 2017-10-23 09:57 itdef 阅读(213) 评论(0) 推荐(0)

mysql mariadb的VC客户端遇到的问题
摘要:在使用VS2017编写数据库客户端 具体设置可参见以下内容 https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-apps-windows-visual-studio.html http://www.cnblogs.com/flipped/ 阅读全文

posted @ 2017-10-20 08:55 itdef 阅读(304) 评论(0) 推荐(0)

设计模式 单例模式 使用模板及智能指针
摘要:单例模式 // Singleton.cpp: 定义控制台应用程序的入口点。// #include "stdafx.h"#include <iostream>#include <memory> using namespace std; template< typename T >class Singl 阅读全文

posted @ 2017-09-01 09:32 itdef 阅读(319) 评论(0) 推荐(0)

设计模式 策略模式2 c++11
摘要:根据需求的不同 选择不同的策略算法 之前是保存的各种策略类的指针 这里直接使用 function bind 选择对应的算法 代码 // 005.cpp: 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <functional> #include <ios 阅读全文

posted @ 2017-08-31 10:36 itdef 阅读(190) 评论(0) 推荐(0)

设计模式策略模式
摘要:参考http://blog.csdn.net/calmreason/article/details/51029285 定义一系列相同的算法 根据不同需求选择不同的算法策略 使用 bind function 见 设计模式 策略模式2 c++11 代码 // 004.cpp: 定义控制台应用程序的入口点 阅读全文

posted @ 2017-08-31 10:16 itdef 阅读(142) 评论(0) 推荐(0)

设计模式之桥接模式 c++11
摘要:参考http://blog.csdn.net/calmreason/article/details/50909321 桥接模式 实现与抽象之间由指针关联 调用sample类 实际是调用sample类保存的实现类的方法 代码: // 003.cpp: 定义控制台应用程序的入口点。 // #includ 阅读全文

posted @ 2017-08-31 10:10 itdef 阅读(199) 评论(0) 推荐(0)

设计模式 工厂模式 使用shared_ptr
摘要:参考http://blog.csdn.net/calmreason/article/details/50903729 所有产品继承同一基本类 由工厂保存基类指针 产生各类产品 代码 // 002.cpp: 定义控制台应用程序的入口点。 // #include "stdafx.h" #include 阅读全文

posted @ 2017-08-31 10:04 itdef 阅读(412) 评论(0) 推荐(0)

查表胡牌判断算法 c++
摘要:根据 日文胡牌算法资料 JAVA 此篇博文资料 改写的C++ 代码 tbl.h 1 #pragma once 2 #include <map> 3 #include <vector> 4 5 void init1(std::map<int, std::vector<int>>& tbl); 6 vo 阅读全文

posted @ 2017-08-26 14:43 itdef 阅读(1591) 评论(0) 推荐(0)

学习计划
摘要:学习计划清单 放在这里 督促自己执行 近期任务 leetcode stl 源码学习 bttorrent编写 (优先BCODE解析) 分布式存储编写 json 解析(实战 大量测试 稳定和内存泄漏) leveldb 源码学习 muduo 源码学习 python csdn 11111Python编程实战 阅读全文

posted @ 2017-08-25 09:29 itdef 阅读(522) 评论(0) 推荐(0)

随机发牌 代码
摘要:// random.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include #include #include #include #include const int MAJIANG_GROUP_LENGTH = 84; const int POST_BLOCK_COUNT = 4; co... 阅读全文

posted @ 2017-08-15 14:13 itdef 阅读(285) 评论(0) 推荐(0)

网络传输 buf 封装 示例代码
摘要:网络传输 buf 封装 示例代码 使用boost库 asio 阅读全文

posted @ 2017-08-15 14:02 itdef 阅读(329) 评论(2) 推荐(0)

简易数据库实现 UNIX环境高级编程(APUE)第二十章 A Database Library
摘要:将课程的源代码 使用C++写了一部分 LINUX WINDOW均可运行 #ifndef MYDB_H #define MYDB_H #include <iostream> #include <fstream> #include <string> #define NHASH_DEF 137 /* de 阅读全文

posted @ 2017-07-25 11:26 itdef 阅读(898) 评论(0) 推荐(0)

状态机学习(六)解析JSON2
摘要:来自 从零开始的 JSON 库教程 从零开始教授如何写一个符合标准的 C 语言 JSON 库 作者 Milo Yip https://zhuanlan.zhihu.com/json-tutorial 根据第二课教程 自己重新编写 做了一点修改 加深学习印象 这里写的有点随便 怎么方便怎么来 浮点的判 阅读全文

posted @ 2017-07-05 14:58 itdef 阅读(986) 评论(0) 推荐(0)

又一篇四则运算代码
摘要:代码分为两段 一段为将输入分解为TOKEN : 0-9 ( ) + _ * / 一段为根据输入进行计算 第一段 #include <iostream> #include <string> #include <vector> #include <deque> #include <tuple> #inc 阅读全文

posted @ 2017-07-02 15:13 itdef 阅读(223) 评论(0) 推荐(0)

c++ stl源码剖析学习笔记(三)容器 vector
摘要:stl中容器有很多种 最简单的应该算是vector 一个空间连续的数组 他的构造函数有多个 以其中 template<typename T> vector(size_type n,const T& value)为例 vector(size_type n,const T& value) -> fill 阅读全文

posted @ 2017-06-09 16:17 itdef 阅读(344) 评论(0) 推荐(0)

c++ stl源码剖析学习笔记(二)iterator
摘要:ITERATOR 迭代器 template<class InputIterator,class T> InputIterator find(InputIterator first,InputIterator last,const T& value) { while(first != last && 阅读全文

posted @ 2017-06-09 11:41 itdef 阅读(313) 评论(0) 推荐(0)

c++ stl源码剖析学习笔记(一)uninitialized_copy()函数
摘要:template <class InputIterator, class ForwardIterator>inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last,ForwardIterator 阅读全文

posted @ 2017-06-09 10:25 itdef 阅读(1704) 评论(0) 推荐(0)

上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 46 下一页

导航