#define check_error(f, ...) _check_error(#f, f, __VA_ARGS__) template void _check_error(const std::string& funcName, Func func, Args... args) { auto is_success= func(args...); if (is_success) { // success handling } else { // error handling } }