How to implement a multi-index dictionary?

前端 未结 11 1465
孤独总比滥情好
孤独总比滥情好 2020-12-14 00:32

Basically I want something like Dictionary, but not (as I\'ve seen here in other question) with the keys in AND, but in OR. To better explain: I

11条回答
  •  独厮守ぢ
    2020-12-14 01:08

    Did you consider holding two dictionaries, one for each key? Adding an item would add it to both.

    Removal means removing from both dictionaries too, and requires both keys. To remove with just one key, the item would have to store both keys. If it doesn't already hold both keys, you could wrap it in a container object that holds both keys and the item.

提交回复
热议问题