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
typically with callbacks a void* is passed when setting the callback, and then when something calls the callback, they will pass it that void*. this allows users to cast the void* in to whatever data they need within the callback.
without this, only static/global data is accessible from within the callback, which is quite limiting.
alternatively, something like std::function or a templated function could be used instead, to allow us to pass a lambda for the callback and capture state.
The text was updated successfully, but these errors were encountered:
for example, if the callback needs to access an object that isn't created in the callback itself (such as a socket, or object) there's no way to have to callback be able to access it, unless it was global
typically callbacks will have a signature with a void*
typically with callbacks a
void*
is passed when setting the callback, and then when something calls the callback, they will pass it thatvoid*
. this allows users to cast thevoid*
in to whatever data they need within the callback.without this, only static/global data is accessible from within the callback, which is quite limiting.
alternatively, something like
std::function
or a templated function could be used instead, to allow us to pass a lambda for the callback and capture state.The text was updated successfully, but these errors were encountered: