Another way is to not try to write generic data structures. When you tailor them to the use case you can simplify.
The #1 data structure in any program is array.
When all you have are arrays, everything looks like a problem you solve with arrays.
There are quite a few problems that specialised containers are suited for, that's why they were created.
When all you have are arrays, everything looks like a problem you solve with arrays.
There are quite a few problems that specialised containers are suited for, that's why they were created.