Hi everyone,
I try to find a data structure that has all the caracteristics of a
map but with something more. I would like it to give me the first
element with the greater or smaller key than a key that I would pass
it.
Example: If I have those keys in a map: 2 5 6 10 11
If I pass it 8, it would return me the element with the key = 6 or key
= 10 depending if I want the greater or the smaller.
I found 'multimap' which I tought would be good with the functions
'lower_bound()' and 'upper_bound()'. The 'upper_bound' works exactly
as I want, but the 'lower_bound' doesn't seems to work as I tought.
I found these descriptions of the functions:
"Lower bound a.lower_bound(k): Returns an iterator pointing to
the first element whose key is not less than k. "
"Upper bound a.upper_bound(k): Returns an iterator pointing to
the first element whose key is greater than k. Returns a.end() if no
such element exists"
Since I'm french, I don't see exactly the difference between "is not
less" or "is greater". Can somebody tell me? Is it '>=' and '>'?
Or is there another data structure that I can use?