摘要: 大家知道,STL中的map底层是用红黑树实现的,其泛型原型如下:template <class _Key, class _Tp, class _Compare, class _Alloc>class map { ...... }其中_Key表示比较的键(key),_Tp表示值(value),_Compare表示比较方式,_Alloc表示内存分配器。一般我们在写map的时候总是类似于写出如下代码:map<int, char*>* my_map = new map<int, char*>;表示键为int类型,值为字符串类型。这里之所以不对_Compare和_Al 阅读全文
posted @ 2011-08-12 09:08 Richard Zhong 阅读(9799) 评论(2) 推荐(7) 编辑