fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. template <size_t N>
  7. class int_to_type {
  8. static const int _N = N;
  9. };
  10.  
  11. struct hoge {
  12. template <int N>
  13. int operator ()(int_to_type<N>)
  14. {
  15. cout << N << endl;
  16. return 0;
  17. }
  18. };
  19.  
  20. int main()
  21. {
  22. // your code goes here
  23. hoge Hoge;
  24. Hoge(int_to_type<2>());
  25. return 0;
  26. }
Compilation error #stdin compilation error #stdout 0s 3340KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:24:23: error: no match for call to ‘(hoge) (int_to_type<2u>)’
  Hoge(int_to_type<2>());
                       ^
prog.cpp:11:8: note: candidate is:
 struct hoge {
        ^
prog.cpp:13:6: note: template<int N> int hoge::operator()(int_to_type<N>)
  int operator ()(int_to_type<N>)
      ^
prog.cpp:13:6: note:   template argument deduction/substitution failed:
prog.cpp:24:23: note:   mismatched types ‘int’ and ‘#‘integer_cst’ not supported by dump_type#<type error>’
  Hoge(int_to_type<2>());
                       ^
prog.cpp:24:23: note:   ‘int_to_type<2u>’ is not derived from ‘int_to_type<N>’
stdout
Standard output is empty