RE: Simplfied vector<> ?

[email protected] ("Moore, Paul") Tue, 2 May 2000 09:19:48 +0100
Newsgroups perl.perl6.porters
Message-ID <714DFA46B9BBD0119CD000805FC1F53BDC3AD0@UKRUX002.rundc.uk.origin-it.com>
From: Chip Salzenberg [mailto:[email protected]]
> 
> 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 ([email protected]). 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.