#include <iostream>
using namespace std;
// If doit's implementation is in another cpp file, you'd want to add
// template doit<true,true>();
// template doit<true,false>();
// ...
// in that file to explicitly instantiate each of the 4 possible functions
template<bool x,bool y>
void doit()
{
cout << x << ", " << y << endl;
}
// possibly not necessary, but used as an example if building all
// permutations via preprocessor gets hairy
template<size_t bitmask>
inline void wrapper()
{
doit<(bitmask/2)%2,bitmask%2>();
}
typedef void (*fptr)();
int main()
{
bool x(true),y(false);
// build via preprocessor
fptr fcn[2][2] = {{wrapper<0>,wrapper<1>},{wrapper<2>,wrapper<3>}};
fcn[x][y]();
return 0;
}