2011年11月25日

摘要: 最近看了侯捷翻译的STL源码剖析,感觉有些启发。迭代器:Allocator 空间配置器,全域函数 construct(), destroy()iterator 是个智能指针,可以从原生指标提取出需要的类别。这样,容器需要实现自己迭代器。容器RB tree的在STL的使用还是很广泛的,不仅是map,set也是用的RB tree根据Vector的特点,迭代器就是使用的原生指针,作为迭代器的指针使用List的迭代器不是原生指针,因为++实际上不是地址的++,而是取得next指针。list遍历的代码,注意拼写 list<int>::iterator ite; for(ite = ilist 阅读全文

posted @ 2011-11-25 15:42 Teddy Yan 阅读(331) 评论(0) 推荐(0) 编辑


Copyright © 2024 Teddy Yan
Powered by .NET 8.0 on Kubernetes