2017年11月23日
摘要: boost 中有一个edmian 里面有转换函数模板 native_to_little<T> 本地转换为小端 native_to_bit<T> 本地转换为大端 阅读全文
posted @ 2017-11-23 11:45 独孤酷酷 阅读(914) 评论(0) 推荐(0) 编辑
  2017年11月2日
摘要: 1 #include 2 #include 3 4 char* cur_time_c(char strDateTime[32]) 5 { 6 struct timeb tp_cur; 7 ftime(&tp_cur); 8 9 struct tm btm; 10 11 #ifdef WIN32 12 localtime_s(&btm, ... 阅读全文
posted @ 2017-11-02 17:47 独孤酷酷 阅读(4245) 评论(0) 推荐(0) 编辑
  2017年9月14日
摘要: 时间函数 阅读全文
posted @ 2017-09-14 10:25 独孤酷酷 阅读(173) 评论(0) 推荐(0) 编辑
  2017年7月14日
摘要: common/pools.h 1 // common/pools.h 2 3 #pragma once 4 5 #include <string> 6 7 #include <boost/pool/pool.hpp> 8 #include <boost/pool/singleton_pool.hpp 阅读全文
posted @ 2017-07-14 16:43 独孤酷酷 阅读(320) 评论(0) 推荐(0) 编辑
  2017年7月11日
摘要: 另外一种,如下: 提示:boost::asio::ip::tcp::acceptor 是没有空参构造函数的。 一大问题: 刚刚发现,将acceptor 的构造拆分成多个函数调用与直接使用构造函数进行构造对客户端的连接处理不同,而且效率差别很大。 具体场景为: 服务器:一个io_service 开10 阅读全文
posted @ 2017-07-11 17:04 独孤酷酷 阅读(1365) 评论(0) 推荐(0) 编辑
  2017年7月5日
摘要: 1 // server.cpp 2 3 #if 0 4 多个线程对同一个io_service 对象处理 5 用到第三方库:log4cplus, google::protobuf 6 用到C++11的特性,Windows 需要用到vs2013 gcc 4.8 7 #endif 8 9 #include 阅读全文
posted @ 2017-07-05 13:45 独孤酷酷 阅读(1026) 评论(0) 推荐(0) 编辑
  2017年5月3日
摘要: 参考自:http://blog.csdn.net/u010607621/article/details/54944696 对于TimeBasedRollingFileAppender 这个日志appender 的功能总结 使用配置文件示例(部分): log4cplus.logger.loggerMk 阅读全文
posted @ 2017-05-03 17:06 独孤酷酷 阅读(1597) 评论(0) 推荐(0) 编辑
  2017年3月1日
摘要: 1 #include 2 #include 3 4 using BoostMutexWR = boost::shared_mutex; 5 using BoostLockW = boost::unique_lock; 6 using BoostLockR = boost::shared_lock; 7 8 void usingLockWR() 9 { 10 Bo... 阅读全文
posted @ 2017-03-01 12:00 独孤酷酷 阅读(1424) 评论(0) 推荐(0) 编辑
  2017年1月26日
摘要: 简单点理解,c++11 中的std::move() 函数,实际上就是将一个左值强制转换成一个右值引用数据类型,从而可以调用相应的对右值引用重载的函数。 如果使用std::move() 的返回值做为参数来调用一个没有对右值引用做重载的函数时,那么std::move() 函数的返回值就相当 于一个常量值 阅读全文
posted @ 2017-01-26 10:22 独孤酷酷 阅读(176) 评论(0) 推荐(0) 编辑
  2017年1月23日
摘要: auto: auto T = xxx; // 产生一个变量,自动推导变量类型。 存在变量拷贝的消耗。auto& T = xxx; // 产生一个变量的引用,自动推导变量类型。减少拷贝的消耗。另外,如果右边的值是一个右值,则引用无效。auto&& T = xxx; // 由右边的类型决定T 的类型,比 阅读全文
posted @ 2017-01-23 15:29 独孤酷酷 阅读(375) 评论(0) 推荐(0) 编辑