fork download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. using namespace std;
  5.  
  6. struct S { void function() { std::cout << __PRETTY_FUNCTION__ << '\n'; } };
  7.  
  8. //template <typename TYPE>
  9. constexpr bool my_test(void (S::*s)()) {
  10. auto a = s;
  11. return is_same<decltype(a), void()>::value;
  12. }
  13.  
  14.  
  15. int main() {
  16. std::cout << "a " << my_test(&S::function);
  17. // your code goes here
  18. return 0;
  19. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
a 0