STL associative containers: Find iterator to where an item *would* be

For STL associative containers, is it possible to find the position to where an item would be, if it existed?

I'm trying to create a banded buffer cache for a networking library. I have a multiset of buffers, ordered on their size. When attempting to get a buffer the user specifies a buffer size. I look in the multiset for buffers of that size. If one exists, return it. If not, find the next size larger (which would just be iterator - 1). If there is none larger, then create a new buffer of specified size.

A simple concept, but find returns iterator == end() if the item doesn't exist.

Is it possible to do what I'm trying here?

TIA
Steve

lower_bound is what you want.
Perfect, thanks!
Topic archived. No new replies allowed.