I need a container (not necessarily an STL container) that allows me to do the following:
I used std :: list , but it will not allow me to insert any position (this happens, but for this I will have to iterate over all the elements, and then insert into the position I want, which is slow since the list can be huge). Can you recommend any effective solution?
, " " - , , , ? !
, , , :
std::map [- , ]
std::map
hash_map std::tr1::unordered_map [-]
hash_map
std::tr1::unordered_map
, , .
vector, deque. vector , deque .
vector
deque
, , . , , .
, vector , ( ), (, ).
std:: deque, ,
. - , , ( , , ) pop_back. ( , !?), push_back ( ) , .
" ", , , , , ?
, . O (log (n)), O (log (n)) O (log (n)). O (n) . , , - , node.
:
, , , . , , node . . , , node. , , , node. node N, . , , N, , . , . , , node N. , A) node B), N .
Containers http://adrinael.net/containerchoice
But it looks like you are looking for one container with the following properties:
And that is not possible. One advantage is causing damage. Choosing a container is a compromise.
std :: vector
[padding for "15 characters" here]