I'm using boost::icl::interval_maps with int intervals and I was wondering how can I get the values for int (key) that belongs to some interval?
For example if we have a interval map that has the following structure
[0, 5): ["A1", "A2"],
[5, 10): ["A2"]
and I use the key 4 I would like to get ["A1", "A2"].
All the examples that I've seen in the boost documentation iterate over the whole structure.
This implementation should work, but there might be a more elegant one, or even a function in icl, which does exactly that. I recommend studying the documentation.
Most functions in icl provide access by the key type, which is the interval. You would like to query for a point, which can be represented by a closed interval [N,N]. lower_bound seems like the the obvious choice followed by a check that this interval is not "above/greater" your query point.