I want to request a series of data from a library, that requires me to specify two types:
class a;
class b;
class c;
template<typename A, typename B> void get() {....}
void get_all() {
get<a,a>()
get<a,b>()
get<a,c>()
get<b,a>()
get<b,b>()
// etc...
}
I want to call the get<A,B> function for every combination of a set of classes (about 10 different variations) - meaning about 100 different calls. I'd rather not code all those get() calls by hand.
Is there some way to generate these calls automatically? I suppose I could use preprocessor macros, but I was curious if there was way to generate such a combinatorial list, given a,b,c,d,... by use of template code.
Edit: Minor complication: in fact, this is all in a member function.
template<typename A, typename B>
void Getter::get()
{
auto assn = fMemberObject->RetrieveAllDataOfType<association<A,B>();
.. do stuff with assn ...
}
void Getter::get_all() {
get<a,a>();
}
So, code needs to deal with passing this along with the templates.
Also, C++11 is probably as far as I want to push the language, if possible....
Edit 2:
Turns out I want to avoid the repeated cases <a,a> and <b,b>...