|
Boost : |
From: Rob Stewart (stewart_at_[hidden])
Date: 2004-09-07 16:12:25
From: Stefan Slapeta <stefan_at_[hidden]>
>
> I'm looking for an associative container which is optimized for one-time
> insertion and avoids much of the overhead of std::map therefore. IIRC
> Andrei once published something like this: a vector of pairs that was
> sorted once and accessed by binary search.
std::vector + std::sort + std::binary_search?
(You'd populate the vector with your data, run std::sort on it,
and then just use std::binary_search from that point forward.)
Other search algorithms which might prove more efficient for your
data type, of course.
> Is there something similar in boost?
Not that I'm aware of, but that doesn't mean there isn't.
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk