fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class String { };
  5. template<class T> class Array { /* ... */ };
  6. template<class T> void sort(Array<T>& v) { /* ... */ }
  7.  
  8. //template<> void sort<String>(Array<String>& v) {}
  9. void f(Array<String>& v) {
  10. sort(v); // use primary template sort(Array<T>&), T is String
  11. }
  12.  
  13. template<> void sort<String>(Array<String>& v) {}
  14. template<> void sort<>(Array<char*>& v) {}
  15.  
  16. int main() {
  17. // your code goes here
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 4520KB
stdin
Standard input is empty
compilation info
prog.cpp:13:46: error: specialization of ‘void sort(Array<T>&) [with T = String]’ after instantiation
 template<> void sort<String>(Array<String>& v)    {}
                                              ^
stdout
Standard output is empty