TinySTL icon indicating copy to clipboard operation
TinySTL copied to clipboard

TinySTL is a subset of STL(cut some containers and algorithms) and also a superset of STL(add some other containers and algorithms)

Results 23 TinySTL issues
Sort by recently updated
recently updated
newest added

编译报错 > D:\Program File\VS\ide\VC\Tools\MSVC\14.35.32215\include\utility(107,5): error C2668: “TinySTL::swap”: 对重载函数的调用不明确 1>D:\study-hard\cpp-project\TinySTL-master\TinySTL\Utility.h(9,7): message : 可能是“void TinySTL::swap(T &,T &)”[通过使用参数相关的查找找到] 1> with 1> [ 1> _Ty=std::_Tree_node *, 1> T=std::_Tree_node * 1> ] 1>D:\Program File\VS\ide\VC\Tools\MSVC\14.35.32215\include\utility(98,19): message...

对于alloc,如果申请了内存池中的内存,用完之后归还给内存池了,这个时候内存池中仍然有申请的内存,在程序结束之前,什么时候释放内存池里面的这些内存呢?

reverse_iterator_t& operator ++(int){ reverse_iterator_t temp = *this; ++(*this); return temp; }

- 使用VS2019打开工程SLN文件,编译不通过 ``` 已启动生成… 1>------ 已启动生成: 项目: TinySTL, 配置: Debug Win32 ------ 1>Alloc.cpp 1>String.cpp 1>C:\Users\cz\Desktop\desk\c++\stl\TinySTL-master\TinySTL-master\TinySTL\String.h(193,15): error C2039: "ostream": 不是 "std" 的成员 1>E:\VS2019community\VC\Tools\MSVC\14.28.29333\include\utility(29): message : 参见“std”的声明 1>C:\Users\cz\Desktop\desk\c++\stl\TinySTL-master\TinySTL-master\TinySTL\String.h(193,22): error C2143: 语法错误: 缺少“;”(在“&”的前面)...

函数mid3进行三点中值的选取,项目中函数代码存在问题 ``` if (pred(*mid, *first)) { swap(*mid, *first); } if (pred(*last, *mid)) { swap(*last, *mid); } if (pred(*last, *first)) { swap(*last, *first); } ``` 例如{3,2,1},经过该函数选取的中值是1,不符合期望

if (!start_free){ obj **my_free_list = 0, *p = 0; for (int i = 0; i next; start_free = (char *)p; end_free = start_free + i; return chunk_alloc(bytes, nobjs); } }...

https://github.com/zouxiaohang/TinySTL/blob/b6bde62f4539241a2ddc7577d39ba61925a132fa/TinySTL/UninitializedFunctions.h#L21 应添加typename,更正如下: ```cpp typedef typename _type_traits::is_POD_type isPODType; ```

![图片](https://user-images.githubusercontent.com/35389982/153519118-f8a44d7d-db60-47b7-97a6-54163bc69868.png) ![图片](https://user-images.githubusercontent.com/35389982/153519160-2c584d45-e14b-4a4d-8dd1-1d106b51f906.png) 是从bytes开始遍历,而不是0开始

Alloc.cpp 的103行开始对malloc分配失败的分支进行处理,遍历所有已有的free obj查看有无可用的free obj,其中for循环应该从i等于bytes开始,因为小于bytes的obj肯定不能满足,然后如果都没有可用的链表,tinystl依然默认其分配成功,并且最后将heap_size加上bytes_to_get和调用chunk_alloc可能导致无限调用

https://github.com/zouxiaohang/TinySTL/blob/b6bde62f4539241a2ddc7577d39ba61925a132fa/TinySTL/Construct.h#L32 这里_type_traits应该给value_type,不应该是Iterator