fork download
  1. #include <iostream>
  2.  
  3.  
  4. template<typename T>
  5. struct S{
  6. void hi(){
  7. std::cout << "base" << std::endl;
  8. }
  9. };
  10. template<typename T, std::size_t I>
  11. struct S<T[I]>{
  12. void hi(){
  13. std::cout << "specialized" << std::endl;
  14. }
  15. };
  16.  
  17. int main() {
  18. S<int>{}.hi();
  19. S<int[4]>{}.hi();
  20. return 0;
  21. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
base
specialized