fork(5) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <typename T, typename U>
  5. struct S
  6. {
  7. unsigned int operator()(T t, U u) const
  8. {
  9. return 1;
  10. }
  11. };
  12.  
  13. template <typename T>
  14. struct S<T,nullptr_t>
  15. {
  16. bool operator()(T t, nullptr_t u) const
  17. {
  18. return 2;
  19. }
  20. };
  21.  
  22. class A{};
  23. class B{};
  24.  
  25. int main() {
  26. A a;
  27. B b;
  28.  
  29. cout << S<A*,B*>()(&a,&b) << endl;
  30. cout << S<A*,nullptr_t>()(&a,nullptr) << endl;
  31.  
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0s 4536KB
stdin
Standard input is empty
stdout
1
1