Skip to content

Instantly share code, notes, and snippets.

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