Containers in #202202241717 are continuous memory structures that adhere to 202202012306 principle. They possess the ownership of their own objects.
They can be categorised into 3 types:
-
sequence, like
array
,list
,forward_list
,deque
andvector
-
associative, like
map
andset
, which is built using binary search tree -
unordered associative, like
unordered_map
andunordered_set
, which is built using hash table
Most of them are iteratable and can be deduced from their built-in 202204182011. The iterator then can iterate through first to last.
Standard libraries’ containers usually define value_type
and iterator
to indicate what type of the value and iterator are stored or used in them. It is advised to follow this convention if a custom container should be used. This could be useful if 202204181536 should be used in the codebase although in C++20, 202203281200 is the better alternative for it.
The default 202205161742# for containers are new
and delete
. You could change it in order to optimise the memory usage.