
It may be needed to store also: * location of data * anything in between key and data (=, spaces) * information about any transformations made by the parser (e.g. transparent handling of \ at the end of lines, escape sequences if they are used, presence or lack of parenthesis, their kind, numeric formatting, ...)
Yes, if we want to restore exact layout this will be required. But I think comments and key locations will be actually enough for majority of uses.
If one deletes a data item will the corresponding metadata dissappear automatically?
No. No support on ptree-level. Only parser knows about the metadata, for ptree it is just another branch in the tree. Btw. comments information will be included in the tree only if user explicitly requests that. It will be a responsibility of the user to update the data as he modifies the tree. Deleting a key will not usually require anything, because "orphaned" keys in metadata will be just ignored. Anyway, in many cases heavy modifications of the tree will render the layout information useless. ptree is not a text editing software.
The metadata my use different allocator than the 'normal' data.
This will require very heavy support from ptree (at the moment you cannot put nodes with different allocators in the same hierarchy). Why would anybody need it? Best regards, Marcin