CommandLineOption and the other "glue" classes were designed with the idea that they'd be passed to MirRunner::run_with() and exist for the lifetime of the server.
It is purely accidental that AddInitCallback (used in the example) doesn't need to exist beyond the initial call to operator().
I don't think it impossible to support your usage for this case: as you imply the wrapper callback could be curried by value. Vis:
CommandLineOption and the other "glue" classes were designed with the idea that they'd be passed to MirRunner: :run_with( ) and exist for the lifetime of the server.
It is purely accidental that AddInitCallback (used in the example) doesn't need to exist beyond the initial call to operator().
I don't think it impossible to support your usage for this case: as you imply the wrapper callback could be curried by value. Vis:
server. add_init_ callback( [&server, callback = self->callback]{ callback(server); });
But I'm not sure this can work for all these classes, or how useful it really is.
Specifically, why isn't the logic you pass to AddInitCallback invoked by the CommandLineOption? Vis:
auto check_blacklist _option = pre_init( CommandLineOpti on(
[](std: :string const& blacklist_regex) { check_blacklist (blacklist_ regex); },
"blacklist" , "Video blacklist regex to use", ""))}; blacklist_ option( *config) ;
...
check_
AFAIC that would remove the need for usc::Blacklist - a check_blacklist() function would suffice.