Is there a way the C++ STL Maps support this, since lower_bound and upper_bound on maps strictly return the value greater than the passed value.
Lower key
U
I always find to compute floor(x) and ceil(x) to be patricularly useful
floor(x) -> greatest element <=x
ceil(x) -> smallest element >= x
floor_it = m.lower_bound(x);
if (floor_it != m.end() && floor_it->first != x)
--floor_it;
ceil_it = m.upper_bound(x);
if (ceil_it != m.end() && (ceil_it-1)->first == x)
--ceil_it;