fork(1) download
  1. #include <iostream>
  2.  
  3. template<typename T, T *ptr>
  4. struct X
  5. {
  6. void f() { std::cout << "primary" << std::endl; }
  7. };
  8.  
  9. template<>
  10. struct X<std::nullptr_t, nullptr>
  11. {
  12. void f() { std::cout << "specialization" << std::endl; }
  13. };
  14.  
  15.  
  16. int i = 10;
  17. int main() {
  18.  
  19. X<int, &i>().f();
  20. X<std::nullptr_t, nullptr>().f();
  21. return 0;
  22. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
primary
specialization