fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. namespace Detail
  5. {
  6. template<typename T>
  7. struct Tag
  8. {
  9. using type = T;
  10. };
  11.  
  12. template<typename S, typename T, T p>
  13. struct Hold
  14. {
  15. typename S::type m_a = p;
  16. static Hold instance;
  17. };
  18.  
  19. template<typename S, typename T, T p>
  20. Hold<S, T, p> Hold<S, T, p>::instance;
  21.  
  22. }
  23.  
  24.  
  25. class A
  26. {
  27. private:
  28. void func()
  29. {
  30. }
  31. };
  32.  
  33. using mtype = void (A::*)();
  34. template struct Detail::Hold<Detail::Tag<mtype>, mtype, &A::func>;
  35.  
  36. int main() {
  37. // your code goes here
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5520KB
stdin
Standard input is empty
stdout
Standard output is empty