fork download
  1. #include <iostream>
  2. #include <utility>
  3. #include <type_traits>
  4.  
  5. namespace Ckb
  6. {
  7.  
  8. struct Version
  9. {
  10. enum { Major = 1, Minor = 0, Release = 0 };
  11. void CheckDependencies()
  12. {
  13. std::cout << "Ckb Check" << std::endl;
  14. }
  15. };
  16.  
  17. } // namespace Ckb
  18.  
  19. namespace Cg
  20. {
  21.  
  22. struct Version { enum { Major = 1, Minor = 8, Release = 1 }; };
  23.  
  24. } // namespace Cg
  25.  
  26. template <typename T, bool> struct RunCheck
  27. { void operator()() {std::cout << "false" << std::endl;} };
  28.  
  29. template <typename T> struct RunCheck<T, true>
  30. { void operator()() { std::cout << "true" << std::endl; } };
  31.  
  32. template <typename T> void Do()
  33. {
  34. RunCheck<T, std::is_member_function_pointer<void(T::*)()>::value>()();
  35. }
  36.  
  37. int main()
  38. {
  39. Do<Cg::Version>();
  40. Do<Ckb::Version>();
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
true
true