FAQ

RE: Simplfied vector<> ?

Moore, Paul
May 2, 2000 at 8:20 am
From: Chip Salzenberg
The standard C++ vector<> container is almost perfect for use in Perl
arrays and the data stack. But it has a major weakness... It's _so_
general that it doesn't use memcpy() [or moral equivalent] when it has
to grow. Instead, it uses copy constructors in a loop. That could be
a major performance issue with vector<Counted_p<T>>.

Now, I could write a vector<> -- it's not that hard, as C++ goes --
but I'm wondering if anyone has a lead on such a thing already, and/or
library(ies) of such handy classes.
I don't know if/how such details are or should be handled, but you might
want to take a look at boost (www.boost.org) or ask on the boost mailing
list (boost@egroups.com). The people there have done a lot of work on
extensions to the STL classes, and may have what you want (I recall
something about a fast allocator, which may help performance of the standard
containers - if not, I'm sure there are people on the list who would be
interested in thrashing out performance issues like this).

On a related note, boost already has a counted pointer class, and they are
working hard on efficiency issues for it, so that may be worth a look, too.

Paul.
reply

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post

1 user in discussion

Moore, Paul: 1 post