fork download
  1. #include <iostream>
  2.  
  3. template <typename DT, int DV, void (DT::*DF)(int)>
  4. struct Description
  5. {
  6. typedef DT T; // OK
  7. static const int V = DV; // OK
  8. static void (T::*F)(int);
  9. };
  10.  
  11. template <typename DT, int DV, void (DT::*DF)(int)>
  12. void (DT::* Description<DT, DV, DF>::F)(int) = DF;
  13.  
  14. struct TestClass
  15. {
  16. void TestFunc( int x ) { std::cout << "Value is: " << x << std::endl; }
  17. };
  18.  
  19. int main()
  20. {
  21. typedef Description<TestClass, 5, &TestClass::TestFunc> TCD;
  22.  
  23. TestClass t;
  24. (t.*(TCD::F))(5);
  25. }
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
Value is: 5