Handlers like readstat_set_variable_handler return an integer error code, but the three available error codes are defined as an enum:
enum {
READSTAT_HANDLER_OK,
READSTAT_HANDLER_ABORT,
READSTAT_HANDLER_SKIP_VARIABLE
};
As a result when registering a handler as a lambda function, I need a cast to avoid compilation errors:
readstat_set_variable_handler(parser, [](int, readstat_variable_t*, const char*, void*) {
return static_cast<int>(READSTAT_HANDLER_OK);
});
While it would make sense to be able to write:
readstat_set_variable_handler(parser, [](int, readstat_variable_t*, const char*, void*) {
return READSTAT_HANDLER_OK;
});
Handlers like
readstat_set_variable_handlerreturn an integer error code, but the three available error codes are defined as an enum:As a result when registering a handler as a lambda function, I need a cast to avoid compilation errors:
While it would make sense to be able to write: