You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
What syntax to use member function/method with service delegate? #5
Following on from test and example code, s.registerDelegate(d) will fail if d is not a free function.
void test() {
// Free function works fine
// auto d = make_delegate(&myFreeFunction);
// But member methods will create an error
A a;
auto d = make_delegate(&A::simple, a);
Service s;
s.registerDelegate(d);
// Error (active) a reference of type "ServiceDelegate &" (not
// const-qualified) cannot be initialized with a value of type
// "dlgt::delegate<void (A::*)()>"
// Error C2664 'void Service::registerDelegate(ServiceDelegate &)': cannot
// convert argument 1 from 'dlgt::delegate<void (__cdecl A::* )(void)>' to
// 'ServiceDelegate &'
s.notifyDelegate();
}
Activity