MyTinySTL
MyTinySTL copied to clipboard
关于容器中的allocator_type get_allocator()函数
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 的确是不同的对象呢?
目前这个区别没有意义。 MyTinySTL 的容器只支持自己的 mystl::allocator
,而同系列的分配器都能彼此间相互隐式转换。