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

Class member functions to be param callback of event_new #1653

Closed
Zshowstopper opened this issue May 10, 2024 · 1 comment
Closed

Class member functions to be param callback of event_new #1653

Zshowstopper opened this issue May 10, 2024 · 1 comment
Labels

Comments

@Zshowstopper
Copy link

Can i use a Class member function to be param callback of event_new ?

@azat
Copy link
Member

azat commented May 18, 2024

Only static functions, or lambdas:

Event::Event()
{
...
event_new(*base, fd, flags,
     [](int fd, short events, void *arg) {
         Event *event = reinterpret_cast<Event *>(arg);
         event->m_functor(fd, events);
     }, reinterpret_cast<void *>(this))
...
}

@azat azat closed this as completed May 18, 2024
@azat azat added the type:q label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants