How to avoid sorting on a map

Is there a way to avoid sorting the map based on the key value. In fact, I want to display all the pairs in the same order in which I insert them into the map.

+5
source share
5 answers

Why not use a vector of pairs? This will be sufficient for your requirement. I think,

+7
source

, "" , , () . , - boost. multi_index. : hashed_unique ordered_unique.

+2

, . , ( ), , . , .

+1

, . std::map<> , O(lg(n)).

std::vector<std::pair<Key,Value>>, , , O(n) .

+1

. , . B-.

, , . , . .

, . - , , , , .

0

All Articles