fork(2) download
  1. template <const int N>
  2. struct UnrolledOp
  3. {
  4. template <const int j, int op(int*, int*)>
  5. static void Do(int* foo, int* l, int* r)
  6. {
  7. return UnrolledOp<N - 1>::Do<j + 4, op>(foo, l, r);
  8. }
  9. };
  10.  
  11. template <>
  12. struct UnrolledOp<0>
  13. {
  14. template <const int j, int op(int*, int*)>
  15. static void Do(int* foo, int* l, int* r) { }
  16. };
  17.  
  18. template <const int fooSize, int op(int*, int*)>
  19. void Op(int* foo, int* l, int* r)
  20. {
  21. UnrolledOp<fooSize / 4>::Do<0, op>(foo, l, r);
  22. }
  23.  
  24. int Test(int* x, int* y)
  25. {
  26. return 0;
  27. }
  28.  
  29. int main()
  30. {
  31. Op<16, Test>(nullptr, nullptr, nullptr);
  32. return 0;
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In static member function ‘static void UnrolledOp<N>::Do(int*, int*, int*)’:
prog.cpp:7:58: error: comparison between distinct pointer types ‘int (*)(int*, int*)’ and ‘int*’ lacks a cast [-fpermissive]
         return UnrolledOp<N - 1>::Do<j + 4, op>(foo, l, r);
                                                          ^
prog.cpp: In function ‘void Op(int*, int*, int*)’:
prog.cpp:21:49: error: comparison between distinct pointer types ‘int (*)(int*, int*)’ and ‘int*’ lacks a cast [-fpermissive]
     UnrolledOp<fooSize / 4>::Do<0, op>(foo, l, r);
                                                 ^
prog.cpp: In instantiation of ‘void Op(int*, int*, int*) [with int fooSize = 16; int (* op)(int*, int*) = Test]’:
prog.cpp:31:43:   required from here
prog.cpp:21:32: error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘int’ to binary ‘operator<’
     UnrolledOp<fooSize / 4>::Do<0, op>(foo, l, r);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
prog.cpp:21:38: error: comparison between distinct pointer types ‘int (*)(int*, int*)’ and ‘int*’ lacks a cast [-fpermissive]
     UnrolledOp<fooSize / 4>::Do<0, op>(foo, l, r);
                                    ~~^~~~~~~~~~~~
stdout
Standard output is empty