Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为何仅支持静态的成员函数,普通的成员函数为何不支持呢? #3

Closed
windflowerly opened this issue Oct 24, 2019 · 4 comments

Comments

@windflowerly
Copy link

为何仅支持静态的成员函数,普通的成员函数为何不支持呢?

@xiaomeixw
Copy link

+1
同问,怎么支持普通成员函数。
实际使用时,基本需求的都是普通函数。

@xiaomeixw
Copy link

为何仅支持静态的成员函数,普通的成员函数为何不支持呢?

找到解决方法了:使用std::mem_fn处理

具体:mem_fn:executor.commit(std::mem_fn(&MMyClass::MMethod),this);
MMethod方法就是普通函数。

@xiaomeixw
Copy link

@lzpong Please Close this Issue!

@lzpong
Copy link
Owner

lzpong commented Dec 20, 2019

没看 readme , 有说明的

commit 直接使用只能调用stdcall函数,但有两种方法可以实现调用类成员,一种是使用 bind: .commit(std::bind(&Dog::sayHello, &dog)); 一种是用 mem_fn: .commit(std::mem_fn(&Dog::sayHello), &dog);```

@lzpong lzpong closed this as completed Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants