Tuesday, 20 August 2013

tying two separate std::lists to each other

tying two separate std::lists to each other

OK, it's a weird problem, I'm not sure there's a solution for that.
I have two lists, say a list of clients and list of some data per each
client. I'm interested to keep the two lists in two separate std::lists
because I have an API for providing the clients-list but I don't want to
provide the rest of the data along with it.
However, as both lists should be aligned against each other, i.e. element
n in each list should refer to the same client, I'm seeking for a way to
link between them such that an element of one list won't be able to be
added/removed without adding/removing the corresponding element in the
other list, but still keep them in two separate lists for the API purpose
that I mentioned.
Any ideas?

No comments:

Post a Comment