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

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

my simplest kv db
摘要:最简单的kv db 最基本的网络连接 使用STL map存储key value 作为多线程互斥的简单例子。 以后有机会逐步优化添加功能 1增加ASIO 异步通讯 2优化存储空间 传递指针 避免过多的拷贝操作 3优化代码结构 4优化全局锁 操作map时候 锁定部分区域而不是锁全局 。(思路在之前博客有 阅读全文

posted @ 2018-02-25 21:44 itdef 阅读(227) 评论(0) 推荐(0)

c++11 线程池学习笔记 (二) 线程池
摘要:学习内容来自以下地址 http://www.cnblogs.com/qicosmos/p/4772486.html github https://github.com/qicosmos/cosmos 有了任务队列 在程序运行之初 就预开启多个执行任务的线程 等待任务队列中传来的元素 对元素进行处理 阅读全文

posted @ 2018-02-19 21:35 itdef 阅读(298) 评论(0) 推荐(0)

c++11 线程池学习笔记 (一) 任务队列
摘要:学习内容来自一下地址 http://www.cnblogs.com/qicosmos/p/4772486.html github https://github.com/qicosmos/cosmos 主要使用c++11的多线程编程的互斥 同步等功能 编写一个生产消费者队列 用于任务的传递 将任务的接 阅读全文

posted @ 2018-02-19 20:46 itdef 阅读(1301) 评论(0) 推荐(0)

c++ boost 苹果内购 IAP验证
摘要:1 // 1111.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <cstdlib> 6 #include <iostream> 7 #include <boost/bind.hpp> 8 #include <boost/as 阅读全文

posted @ 2018-01-06 16:07 itdef 阅读(556) 评论(0) 推荐(0)

c++11 多线程依次打印ABC
摘要:并发 练习代码 阅读全文

posted @ 2018-01-04 15:19 itdef 阅读(1249) 评论(0) 推荐(0)

windows下使用redis c++
摘要:redis是高效key-value NOSQL 数据库 代码开源 windows下使用需要使用微软在redis官方上的改进版 地址 https://redis.io/download 寻找windows的版本 https://github.com/MicrosoftArchive/redis 我这里 阅读全文

posted @ 2018-01-02 16:15 itdef 阅读(11514) 评论(5) 推荐(2)

vc项目中加载多个lib遇到的问题
摘要:一个VC项目中 在网络加密 json解析等方面 加载了多个第三方库和文件 boost cryptpp rapidjson mysql的连接池等等 在使用mysql++的时候 多次报错 LNK 2005 error 。basic_ostream。。。。。。。。。 经过阅读官方网页文档 发现需要将项目运 阅读全文

posted @ 2017-12-29 09:10 itdef 阅读(330) 评论(3) 推荐(1)

目前服务器所需要的技能
摘要:多线程互斥同步 生产消费者队列 json xml解析生成 template shared_ptr shared_from_this 网络库 死锁调试 加密库 基本的数据结构和算法 阅读全文

posted @ 2017-12-27 09:52 itdef 阅读(230) 评论(0) 推荐(0)

c++11 初始化列表 bind function 示例
摘要:1 // 111111111111.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <string> 7 #include <vector> 8 #include <map> 9 10 阅读全文

posted @ 2017-12-09 23:51 itdef 阅读(286) 评论(1) 推荐(1)

c++11 时间相关操作练习
摘要:博客和书籍资料 来自该地址 https://www.cnblogs.com/qicosmos/category/490693.html 自行编写相应代码进行学习 1 // TimeTest.cpp: 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #inc 阅读全文

posted @ 2017-11-30 08:53 itdef 阅读(223) 评论(0) 推荐(0)

C++ Crypto++ RSA加密资料收集
摘要:C++利用Crypto++,vs2005环境下的RSA应用 基于Crypto++/Cryptopp的rsa密钥生成,rsa加密、解密,rsa签名、验签 Keys and Formats 使用Crypto++5.5.2完成RSA加解密,真正的把公钥放在字符串内,而不是放在文件内 C++代码重构——从C 阅读全文

posted @ 2017-11-28 18:10 itdef 阅读(432) 评论(0) 推荐(0)

c++沉思录 学习笔记 第六章 句柄(引用计数指针雏形?)
摘要:一个简单的point坐标类 class Point {public: Point():xval(0),yval(0){} Point(int x,int y):xval(x),yval(y){} int x()const { return xval; } int y()const { return 阅读全文

posted @ 2017-11-14 09:22 itdef 阅读(249) 评论(0) 推荐(0)

c++沉思录 学习笔记 第五章 代理类
摘要:Vehicle 一个车辆的虚基类 class Vehicle {public: virtual double weight()const = 0; virtual void start() = 0; virtual Vehicle* copy() = 0; virtual ~Vehicle() {} 阅读全文

posted @ 2017-11-13 22:21 itdef 阅读(266) 评论(0) 推荐(0)

boost asio 一个聊天的基本框架
摘要:示例代码 1 #include "Util.h" 2 #include "MyAsio.h" 3 #include "TcpConnectionManager.h" 4 #include "SocketMessageRecvDispatchManager.h" 5 /* 6 作 者: itdef 7 阅读全文

posted @ 2017-11-11 13:33 itdef 阅读(330) 评论(1) 推荐(0)

c++11 并发 条件变量 超时等待的代码练习
摘要:资料地址 http://en.cppreference.com/w/cpp/thread/condition_variable/wait_until http://www.cnblogs.com/haippy/p/3252041.html 1 // asdasdwa.cpp: 定义控制台应用程序的入 阅读全文

posted @ 2017-11-06 16:23 itdef 阅读(955) 评论(0) 推荐(0)

boost学习 内嵌类型检测 与 any 的代码练习
摘要:本文是学习 boost源码的一些练习 参考文章来自 刘未鹏 C++的罗浮宫(http://blog.csdn.net/pongba) 目录 http://blog.csdn.net/pongba/article/category/37521 检测内嵌类型 检测一个类中是否存在指定的类型 那么只需要利 阅读全文

posted @ 2017-11-04 17:37 itdef 阅读(458) 评论(0) 推荐(0)

rapidjson 的封装学习
摘要:#pragma once #include "Util.h" #include "rapidjson/writer.h" #include "rapidjson/stringbuffer.h" #include "rapidjson/document.h" NAMESPACEBEGIN(DEF) //参考 https ://github.com/qicosmos/SmartDB1.03/b... 阅读全文

posted @ 2017-11-04 13:38 itdef 阅读(1405) 评论(0) 推荐(0)

trinitycore 魔兽服务器源码分析(三) 多线程相关
摘要:先看LockedQueue.h template <class T, typename StorageType = std::deque<T> >class LockedQueue{......} 一个带锁的多线程可安全访问的类,容器默认使用std::deque 常规代码 push进T类型的元素 p 阅读全文

posted @ 2017-10-28 22:39 itdef 阅读(1106) 评论(0) 推荐(0)

trinitycore 魔兽服务器源码分析(二) 网络
摘要:书接上文 继续分析Socket.h SocketMgr.h template<class T>class Socket : public std::enable_shared_from_this<T> 根据智能指针的使用规则 类中有使用本类自己的指针 必须继承自enable_shared_from_ 阅读全文

posted @ 2017-10-25 16:20 itdef 阅读(3015) 评论(0) 推荐(0)

trinitycore 魔兽服务器源码分析(一) 网络
摘要:trinitycore是游戏服务器的开源代码 许多玩家使用魔兽的数据来进行测试 ,使用它来假设魔兽私服。 官方网址 https://www.trinitycore.org/ 类似的还有mangos 和 kbengine 不过mangos使用庞大的ACE网络框架 kbengine使用自写网络库 两者均 阅读全文

posted @ 2017-10-25 14:05 itdef 阅读(4164) 评论(0) 推荐(0)

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

导航