For a platform-independent model level, I have hierarchical data (rows, actually) that look like this:
- Point a
- SubItem A
- SubItem B
- SubItem C
- SubItem D
- Point B
- Point C
Now, in each "level" (Item, SubItem, SubSubItem, etc.), the elements must be sorted in alphabetical order.
It seems like 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 element. (and one root element). I would need, in general, to go through every detail of the children in the forward direction.
After creating / sorting, I don't need to add or remove elements. Usually a small number of items (hundreds).
This is for organizing a data model of a backup of a control in style.
Slipping a simple class would be easy, but this is such a common pattern - are there any ready-made STL containers with this behavior?
source share