std::map is a class in the C++ Standard Library. It is a sorted associative container that contains key-value pairs with unique keys. Search, removal, and insertion operations have logarithmic complexity. Maps are usually implemented as red-black trees.
Questions tagged [stdmap]
1446 questions
-5
votes
3 answers
whats wrong with this c++ piece of code?
In this piece of code, in every iteration of while loop, a line is read from a file. The line is something like:
13,4636137,29464742,29464746,995560164
for every number specified in bold, the existence of that number as a key in a std::map is…

user2949310
- 33
- 4
-6
votes
1 answer
c++ find a key match in a bi-dimensional map (map of map)
I have the following map that I use to store customer names and a dictionary of itens selected with its code and description, like:
Name Item Code, Item Description
Customer1 -> 1234, Item 1
1233, Item 2
…

Mendes
- 17,489
- 35
- 150
- 263
-6
votes
1 answer
Could I use std::map?
I mean, I would like to use
std::map
to store my data. both of the key and the value is the integer.
But now once I debug it, I could not tracking the contents of the key and the value from debugger.
I use qt creator to debug…

user2701639
- 861
- 2
- 8
- 13
-7
votes
1 answer
c++ overwrite [] operator with std::string
I'm basically trying to create a thread-safe wrapper class for std::map.
As I'm coming from C, I have quite a hard time figuring out all the nuances of C++.
I'm trying to overwrite the [] operator to take std::string arguments to just pass it to my…

pear
- 1
- 3
-7
votes
1 answer
Can't iterate through std::map
Since I've started to using std::map I've started to receive assertion error whenever I click on the button. I want to clear all the contents inside my_map and start adding again everytime I click the button.
my.cpp
typedef std::map…

Xtravagant
- 121
- 8
-11
votes
1 answer
How to create an empty std::map object?
I tried this:
std::map m;
and it works -- m becomes an empty map. But this approach may not work if the compiler choose to not initialize m to an empty map by default. Better solution?

zell
- 9,830
- 10
- 62
- 115