The following is a simple implementation of a full-aligned generic algorithm; I use it to generate test sequences to be used for some code testing; By the way, the generic algorithm is studied; the implementation is still more primitive, and it still needs to be improved; #pragma Warning (Disable : 4530) #pragma Warning (Disable: 4786) #include
// Main, no detection overflow unsigned __int64 _tfactorial (unsigned __int64 n) {unsigned __int64 r = 1; for (unsigned __int64 i = 2; i <= n; i ) r * = i; return r;}
// Run, do not detect repetition template
INT N = Last - First;
IF (n == 1) // Remissive termination {Matrix [ROW] [col] = * first; return;} int line_n = _tfactorial (n - 1); t * temp = new T [n - 1], * CP ;
For (int i = 0, j; i For (cp = temp, j = 0; j Arrange DELETE [] TEMP; INT Main (int Argc, char * argv []) {Try {Int i, j; CHAR C [5] = "1234"; // Waiting for data char RC [24] [4]; // Save results String Str [3] = {"The", "if", "else"}; string rstr [6] [3]; Arrange Arrange ---------- Results -------- 1, 2, 3, 4, 1, 2, 4, 3, 1, 3, 2, 4, 1, 3, 4 2, 1, 4, 2, 3, 1, 4, 3, 2, 2, 1, 3, 4, 2, 1, 4, 3, 2, 3, 1, 4, 2, 3, 4, 1 2, 4, 1, 3, 2, 4, 3, 1, 3, 1, 2, 4, 3, 1, 4, 2, 3, 2, 1, 4, 3, 2, 4, 1, 3 4, 1, 2, 3, 4, 2, 1, 4, 1, 2, 3, 4, 1, 3, 2, 4, 2, 1, 3, 4, 2, 3, 1, 4, 3 , 1,2,4,3,2,1,1, ing, else, there, else, IF, IF, THE, ELSE, IF, Else, The, else, The, IF, Else, IF, THE , B, C, D, B, D, A, C, D, B, A, D, B, C, A, D, C, B, B, A , C, D, B, D, B, C, D, A, B, D, A, C, B, D, C, A, C, A, B , D, C, A, D, B, D, A, C, D, A, B, C, D, B, A, D, A, B, C , D, A, C, B, D, B, A, C, D, B, C, A, D, C, A, B, D, C, B, A,