Pavel Sanda wrote:
Well, the set is a sorted container by definition, see here:
you are right. still i feel there is something strange in set[i] operation :)
The completion popup accesses this containter in a random access way.
Though probably it would be enough to speed up the first access (e.g. for
the first line in the popup). The following accesses will be very near to
the first one, hence the simple iterators can be used here.
My first idea would be to use two maps:
- one std::map<docstring, size_t> sorted by string (to make the lookup by
string fast)
- and std::map<size_t, docstring> sorted by position in the first map (to
make the random access lookup fast).
yes direct using stl ends with two different structures.
just an idea.. what about boost multi index or alike?
Viz:
http://www.boost.org/libs/multi_index/doc/examples.html#example5
or better yet:
http://www.boost.org/libs/multi_index/doc/examples.html#example10
rh