| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
/* { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } } */ |
| 4 |
|
| 5 |
#include <vector> |
| 6 |
|
| 7 |
#define N 10 |
| 8 |
|
| 9 |
static void visit(int &level, int n, int k, std::vector< int > &value) { |
| 10 |
level = level + 1; |
| 11 |
value[k] = level; |
| 12 |
for (int i = 0 ; i < n; i++) |
| 13 |
if (value[i] == 0) |
| 14 |
visit(level, n, i, value); |
| 15 |
} |
| 16 |
void permutations() |
| 17 |
{ |
| 18 |
std::vector< int > value(N); |
| 19 |
int level = -1; |
| 20 |
visit(level, N, 0, value); |
| 21 |
} |
| 22 |
void testExtendByBox() { |
| 23 |
permutations(); |
| 24 |
} |
| 25 |
|
| 26 |
int main() { |
| 27 |
testExtendByBox(); |
| 28 |
return 0; |
| 29 |
} |