I have a number of variables of type User. All objects of this type are located in a set. The number of these variables is not fix so I only can determine it at runtime. Therefore I have a variable number of Iterators. I save them in the following list.
list<set<User>::iterator> userIterators;
for (unsigned int i = 0; i < numberOfUserParameters; i++) {
userIterators.push_back(q->getUserSet()->getUsers().begin()); }
Now I need to get all possible combinations of these n UserIterators. (I know about its computional complexity.)
Of course, if I would only have four parameters, I would write four nested loops but what can I do in this variable case with n parameters?
Thanks in advance!
EDIT:
Here is an example.
numberOfUserParameters = 3, set< User > = { U1, U2 }
So I expect all triples set< User > X set< User > X set< User >, the cartesian product with other words.