随笔 - 483, 文章 - 0, 评论 - 2, 阅读 - 18万

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

09 2015 档案

摘要:单线程:class Singleton{private: static Singleton* _instance; Singleton() { }public: static Singleton* Instance() {... 阅读全文

posted @ 2015-09-21 17:13 ggzone 阅读(134) 评论(0) 推荐(0) 编辑

摘要:单线程:class Singleton{private: static Singleton* _instance; Singleton() { }public: static Singleton* Instance() { if (n... 阅读全文

posted @ 2015-09-21 17:12 ggzone 阅读(146) 评论(0) 推荐(0) 编辑

摘要:以下描述主要是针对windows平台下的TCP socket而言。 首先需要区分一下关闭socket和关闭TCP连接的区别,关闭TCP连接是指TCP协议层的东西,就是两个TCP端之间交换了一些协议包(FIN,RST等),具体的交换过程可以看TCP协议,这里不详细描述了。而关闭so... 阅读全文

posted @ 2015-09-18 11:09 ggzone 阅读(10003) 评论(0) 推荐(0) 编辑

摘要:以下描述主要是针对windows平台下的TCP socket而言。 首先需要区分一下关闭socket和关闭TCP连接的区别,关闭TCP连接是指TCP协议层的东西,就是两个TCP端之间交换了一些协议包(FIN,RST等),具体的交换过程可以看TCP协议,这... 阅读全文

posted @ 2015-09-18 11:09 ggzone 阅读(107) 评论(0) 推荐(0) 编辑

摘要:首先应该了解win32 api closesocket,这里只说msdn文档中叙述不够清晰的地方。首先说缺省情况:l_onoff为0,closesocket立刻返回,但底层依然在持续发包,并且试图优雅关闭连接。这种情况下对于应用程序来说,该连接已经关闭,但底层socket的相关资源还... 阅读全文

posted @ 2015-09-18 11:02 ggzone 阅读(1570) 评论(0) 推荐(0) 编辑

摘要:首先应该了解win32 api closesocket,这里只说msdn文档中叙述不够清晰的地方。首先说缺省情况:l_onoff为0,closesocket立刻返回,但底层依然在持续发包,并且试图优雅关闭连接。这种情况下对于应用程序来说,该连接已经关闭,但底... 阅读全文

posted @ 2015-09-18 11:02 ggzone 阅读(185) 评论(0) 推荐(0) 编辑

摘要:判断类中是否有指定名称的函数:#include#define HAS_MEMBER(member)\template\struct has_member_##member\{\private:\ template \ static auto Ch... 阅读全文

posted @ 2015-09-13 21:25 ggzone 阅读(133) 评论(0) 推荐(0) 编辑

摘要:判断类中是否有指定名称的函数:#include#define HAS_MEMBER(member)\template\struct has_member_##member\{\private:\ template \ static auto Check(int)->dec... 阅读全文

posted @ 2015-09-13 21:24 ggzone 阅读(314) 评论(0) 推荐(0) 编辑

摘要:转自:http://blog.csdn.net/haoel/article/details/1948051测试代码:class Base {public: virtual void f() { cout f(); //Derive::f() b2... 阅读全文

posted @ 2015-09-13 19:36 ggzone 阅读(107) 评论(0) 推荐(0) 编辑

摘要:转自:http://blog.csdn.net/haoel/article/details/1948051测试代码:class Base {public: virtual void f() { cout f(); //Derive::f() b2->f(); //Deri... 阅读全文

posted @ 2015-09-13 19:35 ggzone 阅读(164) 评论(0) 推荐(0) 编辑

摘要:应尽量避免在 where 子句中使用 or 来连接条件,否则将导致引擎放弃使用索引而进行全表扫描,如: select id from t where num=10 or num=20 可以这样查询: select id from t where num=10 unio... 阅读全文

posted @ 2015-09-12 21:21 ggzone 阅读(82) 评论(0) 推荐(0) 编辑

摘要:应尽量避免在 where 子句中使用 or 来连接条件,否则将导致引擎放弃使用索引而进行全表扫描,如: select id from t where num=10 or num=20 可以这样查询: select id from t where ... 阅读全文

posted @ 2015-09-12 21:21 ggzone 阅读(109) 评论(0) 推荐(0) 编辑

摘要:1.下面程序在x64下结果struct st{ int a; long long b; double c;};int main() { st s; cout fun(); delete a; system("pause"); retu... 阅读全文

posted @ 2015-09-11 19:45 ggzone 阅读(189) 评论(0) 推荐(0) 编辑

摘要:1.下面程序在x64下结果struct st{ int a; long long b; double c;};int main() { st s; cout fun(); delete a; system("pau... 阅读全文

posted @ 2015-09-11 19:45 ggzone 阅读(121) 评论(0) 推荐(0) 编辑

摘要:http://zm8.sm-img2.com/?src=http%3A%2F%2Fwww.w2bc.com%2FArticle%2F38320&uid=57422b713ac761e653af7b327bfd9c21&hid=72d420808a7f5a5... 阅读全文

posted @ 2015-09-05 11:05 ggzone 阅读(213) 评论(0) 推荐(0) 编辑

摘要:http://zm8.sm-img2.com/?src=http%3A%2F%2Fwww.w2bc.com%2FArticle%2F38320&uid=57422b713ac761e653af7b327bfd9c21&hid=72d420808a7f5a549c1810ca5934... 阅读全文

posted @ 2015-09-05 11:04 ggzone 阅读(233) 评论(0) 推荐(0) 编辑

摘要:VS2015下测试: decltype:class Foo {};int &func_int_r(void) { int i = 0; return i; };int &&func_int_rr(void) { return 0; };int func_int(void) { ret... 阅读全文

posted @ 2015-09-05 10:54 ggzone 阅读(323) 评论(0) 推荐(0) 编辑

摘要:VS2015下测试: decltype:class Foo {};int &func_int_r(void) { int i = 0; return i; };int &&func_int_rr(void) { return 0; };int func_in... 阅读全文

posted @ 2015-09-05 10:54 ggzone 阅读(317) 评论(0) 推荐(0) 编辑

摘要:返回值优化(Return Value Optimization,简称RVO),是这么一种优化机制:当函数需要返回一个对象的时候,如果自己创建一个临时对象用户返回,那么这个临时对象会消耗一个构造函数(Constructor)的调用、一个复制构造函数的调用(Co... 阅读全文

posted @ 2015-09-04 15:06 ggzone 阅读(140) 评论(0) 推荐(0) 编辑

摘要:返回值优化(Return Value Optimization,简称RVO),是这么一种优化机制:当函数需要返回一个对象的时候,如果自己创建一个临时对象用户返回,那么这个临时对象会消耗一个构造函数(Constructor)的调用、一个复制构造函数的调用(Copy Constructo... 阅读全文

posted @ 2015-09-04 15:05 ggzone 阅读(522) 评论(0) 推荐(0) 编辑

摘要:在全局变量前添加const或者static,则该变量链接性为内部,即文件内有效。可以使用extern声明为外部。如果要让函数的链接性为内部,则函数声明和定义都应使用static关键字。 例子:test.hextern int index;static void fun();test.... 阅读全文

posted @ 2015-09-04 11:14 ggzone 阅读(222) 评论(0) 推荐(0) 编辑

摘要:在全局变量前添加const或者static,则该变量链接性为内部,即文件内有效。可以使用extern声明为外部。如果要让函数的链接性为内部,则函数声明和定义都应使用static关键字。 例子:test.hextern int index;static voi... 阅读全文

posted @ 2015-09-04 11:14 ggzone 阅读(247) 评论(0) 推荐(0) 编辑

摘要:六个默认函数:构造函数(construct)析构函数(destruct)复制构造函数(copy construct)赋值(assign)移动构造函数(move construct)移动赋值(move)测试代码:#include using namespace std;int g_co... 阅读全文

posted @ 2015-09-04 10:39 ggzone 阅读(502) 评论(0) 推荐(0) 编辑

摘要:六个默认函数:构造函数(construct)析构函数(destruct)复制构造函数(copy construct)赋值(assign)移动构造函数(move construct)移动赋值(move)测试代码:#include using namespace... 阅读全文

posted @ 2015-09-04 10:39 ggzone 阅读(199) 评论(0) 推荐(0) 编辑

摘要:把include文件夹(里面是某个库的头文件)拷到自己的项目中,添加头文件时需要使用#include”include\xxx.h”方式,如果打算使用#include”xxx.h”方式。解决方法:项目属性->C++>常规->附加包含目录:$(ProjectDi... 阅读全文

posted @ 2015-09-02 20:21 ggzone 阅读(177) 评论(0) 推荐(0) 编辑

摘要:把include文件夹(里面是某个库的头文件)拷到自己的项目中,添加头文件时需要使用#include”include\xxx.h”方式,如果打算使用#include”xxx.h”方式。解决方法:项目属性->C++>常规->附加包含目录:$(MSBuildProjectDirector... 阅读全文

posted @ 2015-09-02 20:20 ggzone 阅读(2610) 评论(0) 推荐(0) 编辑

摘要:步骤:下载protobuf-2.6.1.zip和protoc-2.6.1-win32.zip,地址:https://github.com/google/protobuf/tags到目录protobuf-2.6.1\vsprojects下打开protobuf.... 阅读全文

posted @ 2015-09-01 18:49 ggzone 阅读(254) 评论(0) 推荐(0) 编辑

摘要:步骤:下载protobuf-2.6.1.zip和protoc-2.6.1-win32.zip,地址:https://github.com/google/protobuf/tags到目录protobuf-2.6.1\vsprojects下打开protobuf.sln将项目libprot... 阅读全文

posted @ 2015-09-01 18:48 ggzone 阅读(1597) 评论(0) 推荐(0) 编辑

摘要:步骤: 1. 安装MySQL数据库 2. 项目属性页->C/C++->常规->附加包含目录:xxx\MySQL Server 5.6\include 3. 项目属性页->链接器->常规->附加库目录:xxx\MySQL Server 5.6\lib ... 阅读全文

posted @ 2015-09-01 14:24 ggzone 阅读(133) 评论(0) 推荐(0) 编辑

摘要:步骤: 1. 安装MySQL数据库 2. 项目属性页->C/C++->常规->附加包含目录:xxx\MySQL Server 5.6\include 3. 项目属性页->链接器->常规->附加库目录:xxx\MySQL Server 5.6\lib 4. 项目属性页->链接器... 阅读全文

posted @ 2015-09-01 14:23 ggzone 阅读(571) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示