For a platform-independent model layer, I have hierarchical data (strings, actually) that look like this:
- Item A
- SubItem A
- SubItem B
- SubItem C
- SubSubItem A
- SubSubItem B
- SubItem D
- Item B
- Item C
Now, within each "level" (Item, SubItem, SubSubItem, etc.) the items need to be sorted alphabetically.
Seems a simple solution would be to create a simple class with a sorted std::Vector or std::MultiMap to track its Children, and a pointer to its Parent. (and one root item). I would need to generally iterate through each item's children in a forward direction.
After construction/sorting, I do not need to add or delete items. Generally small numbers of items (hundreds).
This is for model organization of the backing data of an outline-style control.
Rolling a simple class would be easy, but this is such a common pattern — isn't there already a ready-made STL container with this behavior?