|
Boost : |
From: Matthew Vogt (mvogt_at_[hidden])
Date: 2004-09-08 01:17:26
> > 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?
[snip]
> > Is there something similar in boost?
>
> Not that I'm aware of, but that doesn't mean there isn't.
I think there's a template called 'AssocVector' in Andrei's Loki library, which
was used in place of std::map in Modern C++ Design.
It was a vector of pairs, overlaid with the map interface, implemented as
suggested above.
Matt
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk