@@ -31,10 +31,12 @@ std::function<bool(int)> f5;
31
31
32
32
Delegate<bool (int )> f6;
33
33
Delegate<bool (int )> f7;
34
+
34
35
Delegate<bool (int )> f8;
35
36
36
37
Delegate<bool (int ), Foo*> f9;
37
38
Delegate<bool (int ), Foo*> f10;
39
+
38
40
Delegate<bool (int ), Foo*> f11;
39
41
Delegate<bool (int ), Foo*> f12;
40
42
@@ -48,6 +50,7 @@ void set_f5(const std::function<bool(int)>& _f) { f5 = _f; }
48
50
49
51
void set_f6 (const Delegate<bool (int )>& _f) { f6 = _f; }
50
52
void set_f7 (const Delegate<bool (int )>& _f) { f7 = _f; }
53
+
51
54
void set_f8 (const Delegate<bool (int )>& _f) { f8 = _f; }
52
55
53
56
void set_f9 (const Delegate<bool (int ), Foo*>& _f) { f9 = _f; }
@@ -97,8 +100,9 @@ void loop()
97
100
case F4: f4 (42 ); break ; // [o](int result) -> bool { return o->cb(result); }
98
101
case F5: f5 (42 ); break ; // std::bind(Foo::cbwObj, o, std::placeholders::_1)
99
102
100
- case F6: f6 (42 ); break ; // [o](int result) -> bool { return o->cb(result); }
101
- case F7: f7 (42 ); break ; // std::bind(Foo::cbwObj, o, std::placeholders::_1)
103
+ case F6: f6 (42 ); break ; // [o](int result) -> bool { return o->cb(result); } <==== antipattern for Delegate, use f11 instead
104
+ case F7: f7 (42 ); break ; // std::bind(Foo::cbwObj, o, std::placeholders::_1) <==== antipattern for Delegate, use f11 instead
105
+
102
106
case F8: f8 (42 ); break ; // [](int result) -> bool { return cbCPtr(result); }
103
107
104
108
case F9: f9 (42 ); break ; // [o](int result) -> bool { return o->cb(result); } <==== antipattern for Delegate, use f11 instead
0 commit comments