I want something like an std::map, but I only want to see if the item exists or not, I don't actually need a key AND a value. What should I use?
Looks like you need a std::set.
If you want the same type of behavior as std::map
, then you want std::set
.
If you are mixing insert/delete and query operations, then std::set
is probably the best choice. However, if you can populate the set first and then follow it with the queries, it might be worth looking at using std::vector
, sorting it, and then using a binary search to check for existence in the vector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With