fork download
  1. //#include ...
  2.  
  3. class Window
  4. {
  5. public:
  6. void Show( int number ) const
  7. {
  8. //...
  9. }
  10.  
  11. void ShowDynamic( int number ) volatile
  12. {
  13. //...
  14. }
  15. };
  16.  
  17. void ShowWindows( int param )
  18. {
  19. //...
  20. }
  21.  
  22. int main()
  23. {
  24. Window window;
  25.  
  26. typedef mezutils::Delegate< void( int ) > Notifier;
  27. Notifier notifier;
  28.  
  29. notifier = &ShowWindows;
  30. notifier( 0 );
  31.  
  32. notifier = Notifier( &window, &Window::Show );
  33. notifier( 1 );
  34.  
  35. notifier = [](int x) { /*...*/ };
  36. notifier( 2 );
  37.  
  38. void (*funpc)(int) = func;
  39. notifier = funpc;
  40. notifier( 3 );
  41.  
  42. notifier = [](int arg) { printf("asd %d\r\n",arg); };
  43. notifier(4);
  44. return 0;
  45. }
  46.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Delgates usage example - vs ctp 2012
compilation info
prog.cpp:172:20: error: expected constructor, destructor, or type conversion before ‘(’ token
 _VARIADIC_EXPAND_0X(MEZ_CLASS_GET_FUNCTION_IMPL_CALLS, , , , )
                    ^
stdout
Standard output is empty