Victor Bazarov *nix forums Guru
Joined: 07 Apr 2005
Posts: 3949
|
Posted: Fri Jul 21, 2006 1:03 pm Post subject:
Re: container for insert/delete + fast index
|
|
|
ndbecker2@gmail.com wrote:
| Quote: | I'm looking for an stl-style container that has good performance for
insertion and deletion of elements as well as very fast index
operation.
I'm thinking an stl::list would be good if an external index was
maintained.
I could of course write this, but I wonder if something suitable
already exists?
|
Nothing's perfect. If you don't need isertions or deletetions in the
middle, use 'deque'. If you do need insertion/deletions all over the
container, you're better off rolling your own indexing with 'list',
as you already mentioned. Beware, though, that 'list' is a memory hog.
As always, to judge performance you need to measure, not guess.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask |
|