Possibility to pass class method reference
[command.git] / tests / callable / invokes_class_method.cpp
1 #include <cstring>
2 #include <iostream>
3
4 #include <functional> // std::bind, _1
5
6 #include "TestCallable.h"
7 #include "callable.h"
8
9 using namespace std;
10 using namespace command;
11
12 bool test = false;
13
14 class Class {
15 public:
16     void method(void) {
17         test = true;
18     };
19 };
20
21 int main() {
22     Class c;
23     TestCallable<void> callable(std::bind(&Class::method, &c));
24     callable.callFunction();
25
26     if (test == true) {
27         cout << "Callable class calls provided class member method\n";
28         return 0;
29     }
30
31     cout << "Callable class does not call provided  member method\n";
32
33     return 1;
34 }
35