Embedded it inside an internal struct. Not sure if you can use lambda functions here but meh I prefer the internal struct.
void RMatrix::RepMatrixf()
{
const int MAX = 100; // PROBLEM STARTS BELOW
struct
{
void RepMatrix (int NDR, int size, int PosIR, int calls) // PosIR and calls initates at 0
{
if (calls == 0)
memset(Matrix, 0, sizeof(Matrix)); // clears previous values of matrix **note memset only can set values for 0 or -1 in ints
static int Row = 0; // Row, stored for recursion
static int RepIndex[MAX]; // stores positions of variable to be turned true
for ( ; PosIR < size-(NDR-1); PosIR++) // Position index Replacement is less than number of digits being replaced
{
// Increase of each possible combination index
RepIndex[calls]=PosIR; // sets the replacement value for static array based of which call
if (NDR==1) // NDR is last digit
{
for (int x = 0; x<=calls; x++) // all possible replacement permutation are changed to false
{
Matrix[Row][RepIndex[x]]=true;
}
Row++; // row is increased
}
if (NDR>1) // recursively calls for ever digit in need of being replaced
{
RepMatrix((NDR-1), size, PosIR+1, calls+1);
}
}
return;
}
} Inner;
Inner.RepMatrix(Replace, TotalN, 0, 0);
}