My question is, if i use uint32_t as data type for the key in std::map will it create a huge structure with indexes for each of the 2^32 combinations? Basically I want to generate a couple of 32-bit numbers each of which should be unique. I have the numbers but I am wondering what structure/technique to use to keep them in memory.
Share
No, it will only create entries that you insert.
If you only have a small number (you mention a couple) it might be faster to put them in a vector and do a linear search. If it’s more than a small number a map will be faster of course.