fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class F
  5. {
  6.  
  7. };
  8. class S : public F
  9. {
  10.  
  11. };
  12.  
  13. template<typename X, typename Y>
  14. class check
  15. {
  16. class F { };
  17. static F find( ... );
  18. class T { F f[2]; };
  19. static T find( Y* );
  20. public:
  21. enum { m = sizeof(T) == sizeof(find(static_cast<X*>(0)))};
  22. };
  23.  
  24. template <class Q, class R>
  25. bool checkIf() {
  26. return check<Q, R>::m;
  27. }
  28.  
  29. int main() {
  30. check <class F, class S> t (F,S);
  31. cout<< checkIf<class F, class S>() <<endl;
  32. return 0;
  33. }
Success #stdin #stdout 0s 5504KB
stdin
Standard input is empty
stdout
0