Stay Hungry , Stay Foolish

君子生非异也,善假于物也

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2016年11月2日

摘要: 使用场景 当类对象被shared_ptr管理时,需要在类自己定义的函数中把当前对象作为参数传递给其他函数时,必须传递一个shared_ptr,否则就不能保持shared_ptr管理这个类对象的语义。因为有一个raw pointer指向这个类对象,而shared_ptr对类对象的这个引用没有计数,很可能shared_ptr已经把类对象资源释放了,而那个调用函数还在使用类对象--显然,这肯定会... 阅读全文
posted @ 2016-11-02 15:35 octocat 阅读(257) 评论(0) 推荐(0) 编辑

2016年10月17日

摘要: 使用快捷键注释,单行注释,多行注释,#if 0注释 将文件 mycomment.em点此下载 放到sourceinsight的Base工程的路径下(一般是在C:\Documents and Settings\Administrator\My Documents\Source Insight\Projects\Base),当然推荐存放到该目录下,一般em文件是sourceinsight的宏语言文件,... 阅读全文
posted @ 2016-10-17 15:28 octocat 阅读(417) 评论(0) 推荐(0) 编辑

2016年10月11日

摘要: Reactor这个词译成汉语还真没有什么合适的,很多地方叫反应器模式,但更多好像就直接叫reactor模式了,其实我觉着叫应答者模式更好理解一些。通过了解,这个模式更像一个侍卫,一直在等待你的召唤,或者叫召唤兽。 并发系统常使用reactor模式,代替常用的多线程的处理方式,节省系统的资源,提高系统的吞吐量。 先用比较直观的方式来介绍一下这种方式的优点,通过和常用的多线程方式比较一下,可能更好理解... 阅读全文
posted @ 2016-10-11 12:00 octocat 阅读(285) 评论(0) 推荐(0) 编辑

2016年9月19日

摘要: linux后台运行命令两种方式: 1. command & : 后台运行,你关掉终端会停止运行 2. nohup command & : 后台运行,你关掉终端也会继续运行 简介 Linux/Unix 区别于微软平台最大的优点就是真正的多用户,多任务。因此在任务管理上也有别具特色的管理思想。我们知道,在 Windows 上面,我们要么让一个程序作为服务在后台一直运行,要么停止这个服务。而不... 阅读全文
posted @ 2016-09-19 10:20 octocat 阅读(159) 评论(0) 推荐(0) 编辑

2016年8月26日

摘要: gcc提供了大量的警告选项,对代码中可能存在的问题提出警告,通常可以使用-Wall来开启以下警告: -Waddress -Warray-bounds (only with -O2) -Wc++0x-compat -Wchar-subscripts -Wimplicit-int -Wimplicit-function-declaration ... 阅读全文
posted @ 2016-08-26 09:59 octocat 阅读(284) 评论(0) 推荐(0) 编辑

2016年8月16日

摘要: #include struct Hello { int helloworld() { return 0; } }; struct Generic {}; // SFINAE test template class has_helloworld { typedef char yes[1]; typedef yes no[2]; template... 阅读全文
posted @ 2016-08-16 11:22 octocat 阅读(410) 评论(0) 推荐(0) 编辑

摘要: #include // std::copy #include // std::size_t #include class dumb_array { public: // (default) constructor dumb_array(std::size_t size = 0) : mSize(size), mArray(mSize ? ... 阅读全文
posted @ 2016-08-16 10:41 octocat 阅读(311) 评论(0) 推荐(0) 编辑

2016年8月15日

摘要: typedef struct { int width; int height; }SizeInfo; typedef struct { int x; int y; int width; int height; }ImageRect; /************************************************* // Me... 阅读全文
posted @ 2016-08-15 16:48 octocat 阅读(414) 评论(0) 推荐(0) 编辑

摘要: #include template struct TraitsHelper { static const bool isPointer = false; }; template struct TraitsHelper { static const bool isPointer = true; }; template class Test { public: ... 阅读全文
posted @ 2016-08-15 14:33 octocat 阅读(186) 评论(0) 推荐(0) 编辑

2016年8月5日

摘要: centos samba服务器配置 配置smb.conf文件[share] path = /home/lee writable = yes 添加smb用户smbpasswd -a root 启动smb服务service smb restart 关闭防火墙service iptables stop 设置SELinuxvi /etc/selinux/config SELINUX=enforcing改... 阅读全文
posted @ 2016-08-05 19:36 octocat 阅读(149) 评论(0) 推荐(0) 编辑