fork(11) 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>
  8. struct hanoi
  9. {
  10. hanoi<n-1, src, dst, tmp> before;
  11. typename move_disc<src, dst>::lol disc;
  12. hanoi<n-1, tmp, src, dst> after;
  13. };
  14.  
  15. template<int src, int tmp, int dst>
  16. struct hanoi<0, src, tmp, dst>
  17. {
  18. // recursive base case
  19. };
  20.  
  21. hanoi<3, 1, 2, 3> 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>’:
prog.cpp:10:31:   recursively required from ‘struct hanoi<2, 1, 3, 2>’
prog.cpp:10:31:   required from ‘struct hanoi<3, 1, 2, 3>’
prog.cpp:21:19:   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>’:
prog.cpp:10:31:   required from ‘struct hanoi<3, 1, 2, 3>’
prog.cpp:21:19:   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>’:
prog.cpp:12:31:   required from ‘struct hanoi<2, 1, 3, 2>’
prog.cpp:10:31:   required from ‘struct hanoi<3, 1, 2, 3>’
prog.cpp:21:19:   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>’:
prog.cpp:21:19:   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>’:
prog.cpp:10:31:   required from ‘struct hanoi<2, 2, 1, 3>’
prog.cpp:12:31:   required from ‘struct hanoi<3, 1, 2, 3>’
prog.cpp:21:19:   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>’:
prog.cpp:12:31:   required from ‘struct hanoi<3, 1, 2, 3>’
prog.cpp:21:19:   required from here
prog.cpp:11:39: error: no type named ‘lol’ in ‘struct move_disc<2, 3>’
stdout
Standard output is empty