mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-16 16:33:55 +02:00
💥 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:
@@ -74,8 +74,8 @@ class MutualRecursionHelper {
|
||||
*
|
||||
* @return The return value of `fn`.
|
||||
*/
|
||||
template <std::invocable<> F>
|
||||
std::invoke_result_t<F> fork(F fn) {
|
||||
template <std::invocable F>
|
||||
std::invoke_result_t<F> fork(F&& fn) {
|
||||
using Result = std::invoke_result_t<F>;
|
||||
|
||||
// This IO context will accept incoming calls from `handle()` and
|
||||
@@ -135,7 +135,7 @@ class MutualRecursionHelper {
|
||||
*
|
||||
* @tparam F Some callable function that doesn't take any parameters.
|
||||
*/
|
||||
template <std::invocable<> F>
|
||||
template <std::invocable F>
|
||||
std::invoke_result_t<F> handle(F&& fn) {
|
||||
// If we're not currently engaged in some mutually recursive calling
|
||||
// sequence, then we'll execute the function on this thread
|
||||
@@ -154,7 +154,7 @@ class MutualRecursionHelper {
|
||||
*
|
||||
* @see handle
|
||||
*/
|
||||
template <std::invocable<> F>
|
||||
template <std::invocable F>
|
||||
std::optional<std::invoke_result_t<F>> maybe_handle(F&& fn) {
|
||||
using Result = std::invoke_result_t<F>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user