开发者

what can be the best data structure to hold recursive, multi valued and repeated key-value paired data?

开发者 https://www.devze.com 2023-01-25 06:47 出处:网络
Basically its loading of xml data but it has following 3 properties to be satisfied repetitive (key value pair can repeat)

Basically its loading of xml data but it has following 3 properties to be satisfied

  1. repetitive (key value pair can repeat)
  2. mu开发者_运维知识库ltivalued (single key have multiple value)

In both cases I need to preserve the order of data.


It depends on your complexity requirements (or your expected data complexity), but I used once a multimap<Key, list<Value> > for some project.


I'm not a C++ programmer but this looks like a linked list of linked lists to me.


You can consider using composite design pattern. This link has some relevant information for this context.


No single data structure will satisfy all of these properties. You will have to use inheritance and mix data structures at runtime.

0

精彩评论

暂无评论...
验证码 换一张
取 消