mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-16 05:33:07 +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:
+4
-2
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "../common/configuration.h"
|
||||
#include "../common/plugins.h"
|
||||
#include "../common/utils.h"
|
||||
|
||||
/**
|
||||
* Marker struct for when we use the default Wine prefix.
|
||||
@@ -275,11 +276,12 @@ Configuration load_config_for(const boost::filesystem::path& yabridge_path);
|
||||
* @return The path to the *file* found, or `std::nullopt` if the file could not
|
||||
* be found.
|
||||
*/
|
||||
template <typename F = bool(const boost::filesystem::path&)>
|
||||
template <invocable_returning<bool, const boost::filesystem::path&> F =
|
||||
bool(const boost::filesystem::path&)>
|
||||
std::optional<boost::filesystem::path> find_dominating_file(
|
||||
const std::string& filename,
|
||||
boost::filesystem::path starting_dir,
|
||||
F predicate = boost::filesystem::exists) {
|
||||
F&& predicate = boost::filesystem::exists) {
|
||||
while (starting_dir != "") {
|
||||
const boost::filesystem::path candidate = starting_dir / filename;
|
||||
if (predicate(candidate)) {
|
||||
|
||||
Reference in New Issue
Block a user