Uthash – C macros for hash tables and more
github.com
github.com
https://github.com/FRRouting/frr/blob/master/lib/typesafe.h
https://github.com/FRRouting/frr/blob/master/doc/developer/l...
(disclaimer: it's my work.)
A priority queue is usually implemented as a heap (binary or otherwise) and frequently called that as well, but in more precise usage the gadget (abstract data type) you do INSERT and REMOVE-MIN to is the “priority queue”, and the implementation device of a(n implicit or explicit) tree where the value in any node is smaller than the values in its children is the “heap”. Roughly, “priority queue” is to “heap” like “ordered dictionary / map” is to “search tree”.
(I can’t think of any data structures that use heaps not for a priority queue except for treaps, but then my algorithm-fu is not particularly strong.)
As for shared_ptr, it’s just a refcounted pointer, but that bit of terminology is STL-specific so there might not be much value in learning it.
(e.g. I would just call it "refcnt_ptr" and "heap" [if it is one], respectively)
The STL was designed by A. Stepanov, who I suspect is simply too intelligent for this world. I have no idea what he's talking about half the time, but the rest is brilliant. Long story short; it's trying to solve a much bigger problem using a tool that wasn't built for it.
also he could have designed proper sets and usets. nobody really needs red-black trees when you have b- trees. likewise nobody needs linked-list usets, when you have open addressing or even swisstables.
you cannot copy from one container to another type. even the simpliest self-respecting libs support that.
you still have no string library, only memory buffers. many, many misdesigns in C++. just look at it, you'll get eyeblead
Some of it is conventions of the medium, like the iterators; it's just the C++ way.
You copy (or move, there's a need for the distinction in C++) from ranges to iterators, it's just a more flexible perspective.
C++ has a string library, you may not like it but I'm pretty sure it exists.
I basically need a mapping from arbitrary short strings to unique integer identifiers, with a cardinality in the billions. Too much to keep in memory, most db solutions keel over as well.
For those who are interested in faster hashmaps, I tried bunch of hashmaps and this one performs better than others. This is for C. Maybe C++ has better hashmaps.