I have a map of data; the key is std::string
. I want to perform a binary search on it, but I cannot just use std::map::find()
, because I will provide only a part of the key.
Let's say I have a map with the following keys:
["abc"] -> ...
["efg"] -> ...
["ijk"] -> ...
["iik"] -> ...
I want to search through this with, let's say providing only "i"
, and the search should return:
["ijk"] -> ..., ["iik"] -> ...
Is this possible? I have tried to do this using iterators, but I failed, as I cannot treat them as indexes.
Note: I keep the data in a map, because of other reasons, so I don't want to change it into a different data structure.