lightweight list and hashtable for c++

Started by
4 comments, last by alnite 11 years, 9 months ago
hello.
I'm need of some c++ raw data structures like a list and an hashtable , but without the overhead of stl.
I wish use these structures for containing raw data(point or vector 3d) for 3d models without no other purpose(like function objects ,and other stl functions).
for the list i can do it myself, but for the hashtable i have more problem.
But i ask if there are some library already done , for not reinvent the wheel
Thanks.
Advertisement
The STL shouldn't have much overhead at all if you turn off all debugging features, which is tedious on some compilers.
I've used a lightweight replacement before called RDESTL, which I'd recommend if that's what you're looking for.

I use my own experimental lightweight hashtable (here, here), which only supports lookups and (optionally thread-safe) insertion.
The question would be why do you think STL has "overhead"? Each container has it's expected expectations and limitations. Understand the expectations and limitations to make your decisions.

The c++2011 defines an unordered map (aka hashtable). If you're not using a C++-2011 installation, then you should be able to find something compatible (e.g. boost).
If you can't wait for c++2011 and you are using a somewhat recent gcc or msvc, they both have hashtables as part of the library. The interfaces are even mostly compatible with each other.

If you don't want STL then roll your own. Most libraries will have "overhead" in the sense that it will have features that you don't intend to use.

Eventually you will get bored with writing your Nth inefficient list or hash you will start using canned libraries (ex: STL) like everyone else. Sure once in awhile you will have a "hot" data structure that warrants a handcrafted data structure but that is usually not the case.
I needed some data structures a couple of years ago, and I didn't feel comfortable using STL, so I wrote them myself.

If you write them yourself, you will know the weaknesses and advantages of it, and also they are custom made, so there's a small sense of satisfaction.

But I would stick to everybody else's opinion, use STL they don't cause that much overhead you think they cause.

hello.
I'm need of some c++ raw data structures like a list and an hashtable , but without the overhead of stl.
I wish use these structures for containing raw data(point or vector 3d) for 3d models without no other purpose(like function objects ,and other stl functions).
for the list i can do it myself, but for the hashtable i have more problem.
But i ask if there are some library already done , for not reinvent the wheel
Thanks.


STL overhead is minimal, far smaller than you would've been able to get if you wrote it yourself. Function objects and other functions don't make your code slower, only slightly bigger, by a few bytes. The compiler might even have options to remove them automatically if you don't use it. Your textures take up more space than the entire STL library.

This topic is closed to new replies.

Advertisement