💥 Redo all higher order template functions

This does what we did for a few functions in the last few commits for
every function. We now use either the `std::invocable` concept or our
own `invocable_returning` concept wherever possible to make sure we pass
function types to these template functions, since constraint errors are
a lot more readable than template deduction errors. And instead of
having to specify the return type as a template argument, we now just
use `std::invoke_result_t<F>` instead. The VST3 message handling
functions are still using the good old `typename F` since those are
overloaded polymorphic functions. This was also a good moment to modify
`AdHocSocketHandler::send()` to allow functions returning void (this got
rid of an old fixme where we had to return some dummy value from a
function instead of just not returning anything).
This commit is contained in:
Robbert van der Helm
2021-05-20 00:53:48 +02:00
parent 6c58f4e305
commit e4ca520b64
11 changed files with 91 additions and 93 deletions
+2 -2
View File
@@ -219,7 +219,7 @@ Vst3PluginBridge::Vst3PluginBridge()
// loop or else it will likely segfault at some point
return plugin_proxies.at(request.owner_instance_id)
.get()
.last_created_plug_view->run_gui_task<tresult>([&]() {
.last_created_plug_view->run_gui_task([&]() -> tresult {
return plugin_proxies.at(request.owner_instance_id)
.get()
.context_menus.at(request.context_menu_id)
@@ -285,7 +285,7 @@ Vst3PluginBridge::Vst3PluginBridge()
// REAPER requires this to be run from its provided event
// loop or else it will likely segfault at some point
return plug_view->run_gui_task<tresult>([&]() {
return plug_view->run_gui_task([&]() -> tresult {
return plug_view->plug_frame->resizeView(
plug_view, &request.new_size);
});