FAQ
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.
--
Chip Salzenberg - a.k.a. - <chip@valinux.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
but he stepped in a wormhole and had to go in early." // MST3K

Search Discussions

  • Jean-Louis Leroy at Apr 30, 2000 at 7:28 am

    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>>.
    Have you considered deque<>? It doesn't copy the elements when
    growing.
    Now, I could write a vector<>
    Do you mean a vector_Counted_p<>? Better create a partial
    specialization of vector<>:

    template<class T, class A>
    class vector<Counted_p<T>, A>
    {
    // ...
    };
    --
    Jean-Louis Leroy
    http://users.skynet.be/jll
  • Chip Salzenberg at Apr 30, 2000 at 7:34 am

    According to Jean-Louis Leroy:
    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>>.
    Have you considered deque<>? It doesn't copy the elements when growing.
    That's the good part. The bad part is, no guaranteed contiguous
    storage of elements. That's something I'd rather not lose.
    Now, I could write a vector<>
    Do you mean a vector_Counted_p<>? Better create a partial
    specialization of vector<>:

    template<class T, class A>
    class vector<Counted_p<T>, A>
    {
    // ...
    };
    Ah, that's a good thought indeed. Thanks.
    --
    Chip Salzenberg - a.k.a. - <chip@valinux.com>
    "I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early." // MST3K

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl6-porters @
categoriesperl
postedApr 30, '00 at 5:26a
activeApr 30, '00 at 7:34a
posts3
users2
websiteperl6.org

People

Translate

site design / logo © 2018 Grokbase