Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2003-06-30 14:47:18


Arkadiy wrote:
> Right now we are using a sorted vector instead of a set, to implement
> our relational tables, because set doesn't allow us to search on a
> prefix of a key. Like if a table is indexed on a, b, c, we are not
> able to use equal_range on a, b with the set.

I was able to successfully use a set for the indices into an in-memory database I wrote for my company a few years back. By providing a custom Compare object, I was able to implement prefix-based seeking using equal_range. I allowed an element to indicate that it is truncated (e.g. contains only a and b, but not c). The Comparison function used the indication when checking whether one element is less than another.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk