fork(5) download
  1. template<int src, int dst>
  2. struct move_disc
  3. {
  4. // member access will print src and dst
  5. };
  6.  
  7. template<int n, int src, int tmp, int dst, int id>
  8. struct hanoi
  9. {
  10. hanoi<n-1, src, dst, tmp, id*2> before;
  11. typename move_disc<src, dst>::lol disc;
  12. hanoi<n-1, tmp, src, dst, id*2+1> after;
  13. };
  14.  
  15. template<int src, int tmp, int dst, int id>
  16. struct hanoi<0, src, tmp, dst, id>
  17. {
  18. // recursive base case
  19. };
  20.  
  21. hanoi<3, 1, 2, 3, 1> go;
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of ‘struct hanoi<1, 1, 2, 3, 4>’:
prog.cpp:10:37:   recursively required from ‘struct hanoi<2, 1, 3, 2, 2>’
prog.cpp:10:37:   required from ‘struct hanoi<3, 1, 2, 3, 1>’
prog.cpp:21:22:   required from here
prog.cpp:11:39: error: no type named ‘lol’ in ‘struct move_disc<1, 3>’
     typename move_disc<src, dst>::lol disc;
                                       ^
prog.cpp: In instantiation of ‘struct hanoi<2, 1, 3, 2, 2>’:
prog.cpp:10:37:   required from ‘struct hanoi<3, 1, 2, 3, 1>’
prog.cpp:21:22:   required from here
prog.cpp:11:39: error: no type named ‘lol’ in ‘struct move_disc<1, 2>’
prog.cpp: In instantiation of ‘struct hanoi<1, 3, 1, 2, 5>’:
prog.cpp:12:39:   required from ‘struct hanoi<2, 1, 3, 2, 2>’
prog.cpp:10:37:   required from ‘struct hanoi<3, 1, 2, 3, 1>’
prog.cpp:21:22:   required from here
prog.cpp:11:39: error: no type named ‘lol’ in ‘struct move_disc<3, 2>’
prog.cpp: In instantiation of ‘struct hanoi<3, 1, 2, 3, 1>’:
prog.cpp:21:22:   required from here
prog.cpp:11:39: error: no type named ‘lol’ in ‘struct move_disc<1, 3>’
prog.cpp: In instantiation of ‘struct hanoi<1, 2, 3, 1, 6>’:
prog.cpp:10:37:   required from ‘struct hanoi<2, 2, 1, 3, 3>’
prog.cpp:12:39:   required from ‘struct hanoi<3, 1, 2, 3, 1>’
prog.cpp:21:22:   required from here
prog.cpp:11:39: error: no type named ‘lol’ in ‘struct move_disc<2, 1>’
prog.cpp: In instantiation of ‘struct hanoi<2, 2, 1, 3, 3>’:
prog.cpp:12:39:   required from ‘struct hanoi<3, 1, 2, 3, 1>’
prog.cpp:21:22:   required from here
prog.cpp:11:39: error: no type named ‘lol’ in ‘struct move_disc<2, 3>’
prog.cpp: In instantiation of ‘struct hanoi<1, 1, 2, 3, 7>’:
prog.cpp:12:39:   recursively required from ‘struct hanoi<2, 2, 1, 3, 3>’
prog.cpp:12:39:   required from ‘struct hanoi<3, 1, 2, 3, 1>’
prog.cpp:21:22:   required from here
prog.cpp:11:39: error: no type named ‘lol’ in ‘struct move_disc<1, 3>’
stdout
Standard output is empty