develooper Front page | perl.perl6.porters | Postings from May 2000

RE: Simplfied vector<> ?

Thread Previous | Thread Next
Moore, Paul
May 2, 2000 01:20
RE: Simplfied vector<> ?
Message ID:
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 ( or ask on the boost mailing
list ( 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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About