本仓库原是《STL源码剖析》一书的代码合集,后续在其基础上运用部分C++17特性进行了代码改写。
最终希望参考SGI STL SOURCE与 folly src 实现一个MiniSTL。
针对sgi stl src与folly src,有学习计划如下:
- 第一阶段:通读《STL源码剖析》全文,了解数据结构的底层实现与算法流程,针对书本完成代码撰写与整理。
- 第二阶段:补全各容器实现。
- 第三阶段:针对现有内容撰写完备的单元测试。
- 第四阶段:逐步完善现有实现完成一个简易STL。(进行中)
- 最终阶段:尝试改进现有实现,并与std做性能对比,分析原因。
- 空间适配器(allocator)
- 迭代器与traits编程技法(iterator && traits)
iterator_traits(stl_iterator.h)
- 序列式容器(sequence containers)
priority_queue(stl_priority_queue.h)
- 关联式容器(associattive containers)
map(stl_map.h) multiset(stl_multiset.h)
- 算法(algorithm)
- 函数对象(function object)
- 配接器(adapter)
容器类配接器(stack、queue)
迭代器配接器(insert_iterator、reverse_iterator、istream_iterator)
函数配接器(not1、not2、bind1st、bind2nd、compose1、compose2、ptr_fun...)
- 智能指针(smart_pointer)
shared_ptr(shared_ptr.h)
unique_ptr(unique_ptr.h)
OS:macOS Monterey 12.1
CXX_Compiler:Apple clang version 13.0.0
Cmake:3.21.4
CppVersion:C++17
- git clone this repo
-
cd $work_path/MiniSTL && mkdir build && cd build; cmake .. && make;
libSTL.ais in$work_path/MiniSTL/build/Source
- run unit_test need install gtest
- git clone this repo
-
cd $work_path/MiniSTL && mkdir build && cd build; cmake .. -DENABLE_MINISTL_TEST=ON && make;
- run exec file
TESTin$work_path/MiniSTL/build/Test
MIT.