1 / 4
文档名称:

总结:C STL 容器.doc

格式:doc   大小:141KB   页数:4页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

总结:C STL 容器.doc

上传人:ffy51856fy 2019/6/12 文件大小:141 KB

下载得到文件列表

总结:C STL 容器.doc

相关文档

文档介绍

文档介绍:STL的叫法是“容器”,标准库里面容器不多,数组、链表、红黑树,实现都不负责threadsafe、mutable之类,对比下Java的,选择很多,也挺混乱。。序列容器:动态数组vector,双端队列deque(本质是动态数组加索引),链表list。关联容器:set,map,multiset,multimap,bitset(叫bit_array更合适)。容器适配器:stack,queue,priority_queue。除了bitset,都用到模板,声明大概是这样的:STLStandardContainers,点击加号展开!STLContainerAdaptors,点击加号展开!C++是注重效率的,所以STL很强调一点就是amortized的性能,下面的表很不错,还可以用来速查: SequencecontainersAssociativecontainersHeaders<vector><deque><list><set><map><bitset>plexvectordequelistsetmultisetmapmultimapbitsetconstructor*constructorconstructorconstructorconstructorconstructorconstructorconstructorconstructordestructorO(n)destructordestructordestructordestructordestructordestructordestructoroperator=O(n)operator=operator=operator=operator=operator=operator=operator=operatorsiteratorsbeginO(1)beginbeginbeginbeginbeginbeginbeginendO(1)endendendendendendendrbeginO(1)rbeginrbeginrbeginrbeginrbeginrbeginrbeginrendO(1)rendrendrendrendrendrendrendcapacitysize*sizesizesizesizesizesizesizesizemax_size*max_sizemax_sizemax_sizemax_sizemax_sizemax_sizemax_sizeemptyO(1)emptyemptyemptyemptyemptyemptyemptyresizeO(n)essfrontO(1)frontfrontfrontbackO(1)backbackbackoperator[]*operator[]operator[]operator[]operator[]atO(1)atatmodifiersassignO(n)assignassignassigninsert*insertinsertinsertinsertinsertinsertinserterase*eraseeraseeraseeraseeraseeraseeraseswapO(1)swapswapswapswapswapswapswapclearO(n)clearclearclearclearclearclearclearpush_fro