MyTinySTL icon indicating copy to clipboard operation
MyTinySTL copied to clipboard

关于容器中的allocator_type get_allocator()函数

Open alwaysmil opened this issue 1 year ago • 1 comments

vector.h中:allocator_type get_allocator() { return data_allocator(); } list.h中:allocator_type get_allocator() { return node_allocator(); } deque.h中:allocator_type get_allocator() { return allocator_type(); } 为什么函数返回值类型都是allocator_type,但是函数体中 return 的确是不同的对象呢?

alwaysmil avatar Mar 08 '23 13:03 alwaysmil

目前这个区别没有意义。 MyTinySTL 的容器只支持自己的 mystl::allocator ,而同系列的分配器都能彼此间相互隐式转换。

frederick-vs-ja avatar Apr 10 '23 16:04 frederick-vs-ja