Suppose I have a big pile of papers, and need to sort them into chapters, then sort the chapters into a book.
But then suppose the above-mentioned book is really just a page in a chapter of a larger book, and this might go arbitrarily deep, or wide. Regardless of the dimensions, the memory footprint will be tiny, so that's not a concern...I just need to cook up some kind data-structure, maybe a tree or something, to store stuff in an ordered fashion.
Having a bit of trouble wrapping my head around the whole thing, and I'd really like to avoid having to do any manual memory management. I have some foggy notions of linked-lists, maps, pointers, trees, red-black-things, but nothing is coming together in any sort of recognizable solution.
If anyone has some input on how I might do this, it's greatly appreciated.
I guess I'm looking for some variable-dimensioned container, like a map<key, element> container, where the element is another map<key, element>, which could go arbitrarily deep, like a recursive definition or something:
The above has me wincing at what are probably some ugly logical flaws; my first post really kind of says it most clearly. I'll try to elaborate more tomorrow I think.