Skip to content

Instantly share code, notes, and snippets.

@beto-bit
beto-bit / func.hpp
Last active October 16, 2023 13:53
Function Pointer wrapper with zero overhead
template<typename Signature>
struct FuncPtr;
template<typename ReturnType, typename... Args>
struct FuncPtr<ReturnType(Args...)> {
ReturnType (*func_ptr)(Args...);
FuncPtr(ReturnType (*func)(Args...)) : func_ptr(func) {}
ReturnType operator()(Args... args) {