diff --git a/libraries/Network/src/NetworkEvents.cpp b/libraries/Network/src/NetworkEvents.cpp index 9ebf00b476a..6792811766f 100644 --- a/libraries/Network/src/NetworkEvents.cpp +++ b/libraries/Network/src/NetworkEvents.cpp @@ -225,10 +225,8 @@ void NetworkEvents::removeEvent(NetworkEventCb cbEvent, arduino_event_id_t event } } -template static size_t getStdFunctionAddress(std::function f) { - typedef T(fnType)(U...); - fnType **fnPointer = f.template target(); - return (size_t)*fnPointer; +static size_t getStdFunctionAddress(NetworkEventFuncCb cbEvent) { + return *(size_t *)(void *)&cbEvent; } void NetworkEvents::removeEvent(NetworkEventFuncCb cbEvent, arduino_event_id_t event) {