fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<typename T, T t>class test2{
  5. public:
  6. void f();
  7. };
  8.  
  9. void test2<typename T, T t>::f(){
  10. cout<<t;
  11. };
  12.  
  13. int main() {
  14. test2<int,5> t;
  15. t.f();
  16. return 0;
  17. }
Compilation error #stdin compilation error #stdout 0s 3468KB
stdin
Standard input is empty
compilation info
prog.cpp:9:27: error: wrong number of template arguments (1, should be 2)
 void test2<typename T, T t>::f(){
                           ^
prog.cpp:4:32: note: provided for 'template<class T, T t> class test2'
 template<typename T, T t>class test2{
                                ^
prog.cpp: In function 'void f()':
prog.cpp:10:8: error: 't' was not declared in this scope
  cout<<t;
        ^
stdout
Standard output is empty