C++ 语言学习
雨轩剑
大家好,互相学习进步
展开
-
Thinking in C++ learning(1)-----C in C++
1.& 语法糖 2.Make 编译控制 //{L} Global2 带有Global2名字的文件要被连接进来(很像xdoclet)3.变量的定义:extern, static(两种含义:作用域内不变,指定作用域) and automatic4.Link: internal linkage 和 external linkage 5.C++ 显示转换 l=static_cast(i);原创 2006-12-08 14:49:00 · 856 阅读 · 0 评论 -
Inside The C++ Object Model ---- Object Lessons
1. Layout Cost for Adding Encapsulationinheritance dont have cost. But virtual function and virtual base class will add extra cost.2. C++ Object ModelHow Compiler implement the OO:A Simple Object M原创 2007-02-19 22:08:00 · 792 阅读 · 0 评论 -
编程珠玑的一道令我surprise的题目,竟然和Google的笔试题一样。
其实题目很简单,就是计算一个整数数组中,连续的最大子数组。 一开始想到肯定是个O(n*n)的算法:maxSectionGood 后来使用递归O(n*log(n)):maxSectionExcellent 最经典的是最后一个算法,提升到了O(n):maxSectionPrefectGoogle 笔试题:input: an array of int which repr原创 2010-12-16 10:36:00 · 992 阅读 · 0 评论 -
The Annotated STL Sources 读后感
最近看了侯捷翻译的STL源码剖析,感觉有些启发。迭代器:Allocator 空间配置器,全域函数 construct(), destroy()iterator 是个智能指针,可以从原生指标提取出需要的类别。这样,容器需要实现自己迭代器。容器RB tree的在STL的使用还是很广泛的,不仅是map,set也是用的RB tree根据Vector的特点,迭代器原创 2011-11-25 15:42:50 · 1404 阅读 · 0 评论