If I understand it correctly, both std::map and std::unordered_map store keys explicitely (store pairs of keys / values). Is there some other ready to use container (std, boost or other widespread implementation) which would not store the key, but rather allow deriving the key from the stored value using a function (i.e. to use implicit key?).
std::set
or std::unordered_set
, with suitable hash and/or comparison functions for the stored value type.
However, lookup will be done by the stored value type, not the key, so you'll also need a way to fabricate a temporary object from a key.
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