当前位置:网站首页>STL learning notes 0x0001 (container classification)
STL learning notes 0x0001 (container classification)
2022-04-23 05:27:00 【What’smean】
STL Six parts :
An algorithm is like an operation , The contents of the operation are contained in the container , Generally, the algorithm operates on the container through the iterator ; Iterators are like pointers , A pointer is a generalization , Can point to elements in the container ; Allocators are used to allocate memory space to elements in containers , The adapter is like a transformer , Fit the components of the .( Personal understanding , If there is any mistake, please point out )
Code example :

About the classification of containers :
Containers fall into three broad categories :
1.sequence
array: Fixed length
vector: Before closed after opening 、end Point to the position after the last element 、 The elements are not necessarily stored in a continuous space 、vector Each expansion of memory is twice as large (eg: Allocate space for the first time 1, The second space is expanded to 2, The third expansion is 4....)
deque: Both ends can be inserted or deleted (stack、queue There are two Limited deque)
list: Double ended chain storage , Space dynamic expansion
forward-list: Single chain storage
2.associative
set/multiset: Have their own find function , Red black tree storage method ,set Storing the same content element is not supported ,multiset Support storing the same content elements .
map/multimap: With <key,value> Of pair Store data in form , Have their own find function , Red black tree storage method ,multimap The use of... Is not supported in [i] Insertion of form , stay map The same... Is not allowed in key The value is .

3.unordered
unordered set/multiset unordered map/multimap The storage form is as follows , With hash table Form storage of .

Add :deque Memory allocation form

版权声明
本文为[What’smean]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220544124323.html
边栏推荐
- Graphics.FromImage报错“Graphics object cannot be created from an image that has an indexed pixel ...”
- 2021-09-28
- Why can't V-IF and V-for be used together
- node中的redis使用--ioredis
- 2021-10-08
- Open source rule engine - Ice: dedicated to solving flexible and complex hard coding problems
- d. TS --- for more detailed knowledge, please refer to the introduction on the official website (chapter of declaration document)
- App Store年交易额100万美元只缴15%佣金,中小开发者心里很矛盾
- 狼叔来找翻译人员了--plato--持续翻译中.....
- 【openh264】cmake: msopenh264-static
猜你喜欢

Fast application fuzzy search

Blender programmed terrain production

C test calls the paddlesharp module to recognize pictures and words

Box collapse and margin collapse

npm升级后问题,慌得一批

CPT 104_ TTL 09

Use of ES6 array

Five key technologies to improve the devsecops framework

領域驅動模型DDD(三)——使用Saga管理事務

Low code and no code considerations
随机推荐
Use of uniapp native plug-ins
Five key technologies to improve the devsecops framework
Three 之 three.js (webgl)简单实现根据点绘制线/弧线(基于LineGeometry / Line2 / LineMaterial,绘制两点基于圆心的弧线段)
The 2021 IT industry project management survey report was released!
Camera imaging + homography transformation + camera calibration + stereo correction
!!!!!!!!!!!!!!!!!!
2021-11-01
Double click The jar package cannot run the solution
WTL self drawn control library (cqscheckcomboxbox)
Necessity of selenium preloading cookies
Multiple mainstream SQL queries only take the latest one of the data
Click the Add button - a box appears (similar to adding learning experience - undergraduate - Graduate)
selenium预先加载cookie的必要性
Uniapp wechat sharing
Ehcache Memcache redis three caches
How to realize adaptive layout
Create cells through JS (while loop)
Modèle axé sur le domaine DDD (III) - gestion des transactions à l'aide de Saga
Laravel routing job
Simple and basic use of switch and if