... just use the Perl array and use splice to insert or delete if you need to ... there is no need for a specific linked list implementation in Perl

Agreed. I too find Perl's arrays a delight to use. :)

I guess that I don't really understand what is meant by a C++ vector

A C++ vector is similar to a Perl array. Like C arrays, C++ vectors use contiguous storage locations for their elements (great for CPU cache performance), while their size can change dynamically, with storage handled automatically by the container (great for protection from dreaded C memory faults).

A Perl hash table calculates a "vector" to a short linked list. Perl has an algorithm such that, in general, when these "short linked lists" become too long, Perl doubles the hash size and creates more "vectors".

I have not studied how Perl implements its hash tables; I hope to find more time to study them in the future. The standard C++ library equivalent of a Perl hash are the UnorderedAssociativeContainers, especially std::map and std::unordered_map.

Though the C++ standard library is an interface and does not specify implementation (thus allowing library implementations to adapt to new hardware in the future), I believe that std::map is usually implemented using red-black trees, while std::unordered_map (closest to Perl's hashes) is usually implemented, apparently due to a small "oversight" in the specification, by "storing a linked list to external nodes in the array of buckets".

There are a wide variety of associative containers in the C++ standard library, all sharing a similar interface. For example, in High Performance Game of Life:


In reply to Re^7: [OT:] Is this Curriculum right? by eyepopslikeamosquito
in thread [OT:] Is this Curriculum right? by karlgoethebier

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.