2016年8月15日
摘要: 阅读g2log时,发现有两行代码居然看不懂。 1. auto bg_call = [this, log_directory]() {return pimpl_->backgroundChangeLogFile(log_directory);}; 2. auto bg_call = [&]() {return pimpl_->backgroundFileName();}; https://z... 阅读全文
posted @ 2016-08-15 15:14 逸蒙 阅读(2378) 评论(0) 推荐(0) 编辑
  2016年8月12日
摘要: ‍以前仅知道创建对象,但对匿名对象的了解基本为0。 通过阅读google chromium源代码 中关于 log 的使用,查阅相关资料,了解了一下匿名对象,予以记录。 什么是匿名对象‍ 匿名对象可以理解为是一个临时对象,一般系统自动生成的,如你的函数返回一个对象,这个对象在返回时会生成一个临时对象。 #include class myclass {public: myclass() { ... 阅读全文
posted @ 2016-08-12 17:11 逸蒙 阅读(178) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/code_crash/article/details/4854939 不完整类型 C与C++关于不完整类型的语义是一样的。不完整类型是这样一种类型,它缺乏足够的信息例如长度去描述一个完整的对象。 前向声明就是一种常用的不完整类型: class base; struct test; base和test只给出了声明,没有给出定义。不完整类型必须通过某种... 阅读全文
posted @ 2016-08-12 13:42 逸蒙 阅读(290) 评论(0) 推荐(0) 编辑
摘要: http://dog250.blog.51cto.com/2466061/1612791 可以说sk_buff结构体是Linux网络协议栈的核心中的核心,几乎所有的操作都是围绕sk_buff这个结构体进行的,它的重要性和BSD的mbuf类似(看过《TCP/IP详解 卷2》的都知道),那么sk_buff是什么呢?sk_buff就是网络数据包本身以及针对它的操作元数据。想要理解sk_buff,最简单的... 阅读全文
posted @ 2016-08-12 10:50 逸蒙 阅读(1277) 评论(0) 推荐(0) 编辑
  2016年7月18日
摘要: 重读C++ Primer 中以下代码,发现不知道怎么结束输入,一旦输入Ctrl + c,程序结束。 #include int main(){ int sum = 0, value; while (std::cin >> value) { sum += value; } // while(std::cin>>value) std::cout << "Sum is " << s... 阅读全文
posted @ 2016-07-18 16:20 逸蒙 阅读(3286) 评论(0) 推荐(0) 编辑
摘要: 智能指针(Smart pointer)是一种抽象的数据类型。在程序设计中,它通常是经由类别模板(class template)来实做,借由模板(template)来达成泛型,通常借由类别(class)的析构函数来达成自动释放指针所指向的内存或对象。 auto_ptr[c++11弃用]、unique_ptr[c++11支持] 、shared_ptr[c++11支持]、weak_ptr[c++11支持... 阅读全文
posted @ 2016-07-18 14:32 逸蒙 阅读(176) 评论(0) 推荐(0) 编辑
  2016年7月12日
摘要: 最近阅读google chromium base container stack_container代码,深刻感觉到基础知识不扎实。 // Casts the buffer in its right type.T* stack_buffer() { return stack_buffer_.template data_as(); }const T* stack_buffer() const { ... 阅读全文
posted @ 2016-07-12 13:35 逸蒙 阅读(4139) 评论(0) 推荐(0) 编辑
  2016年7月11日
摘要: Iterator definitions An iterator is any object that, pointing to some element in a range of elements (such as an array or a container), has the ability to iterate through the elements of that range u... 阅读全文
posted @ 2016-07-11 14:02 逸蒙 阅读(693) 评论(0) 推荐(0) 编辑
  2016年7月8日
摘要: google chromium base MRU_Cache 支持反向erase iterator Erase(iterator pos) { deletor_(pos->second); index_.erase(pos->first); return ordering_.erase(pos);} // MRUCache entries are often processed in re... 阅读全文
posted @ 2016-07-08 15:36 逸蒙 阅读(2216) 评论(0) 推荐(0) 编辑
  2016年6月27日
摘要: Linux内核同步机制之(一):原子操作 http://www.wowotech.net/linux_kenrel/atomic.html 一、源由 我们的程序逻辑经常遇到这样的操作序列: 1、读一个位于memory中的变量的值到寄存器中 2、修改该变量的值(也就是修改寄存器中的值) 3、将寄存器中的数值写回memory中的变量值 如果这个操作序列是串行化的操作(在一个thread中串... 阅读全文
posted @ 2016-06-27 16:57 逸蒙 阅读(11650) 评论(0) 推荐(1) 编辑