mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Fix the return type constraint
Apparently T is only convertible to T if it can be copy constructed.
This commit is contained in:
+9
-1
@@ -45,6 +45,14 @@ constexpr char product_name_override[] = "Get yabridge'd";
|
||||
*/
|
||||
constexpr char vendor_name_override[] = "yabridge";
|
||||
|
||||
/**
|
||||
* The constraint is satisfied if the type is the same as `To`, or if it can be
|
||||
* implicitly converted to it. The implementation of the constraint requires
|
||||
* types to be copy constructable for them to be implicitly convertible. */
|
||||
template <typename From, typename To>
|
||||
concept same_or_convertible_to =
|
||||
std::same_as<From, To> || std::convertible_to<From, To>;
|
||||
|
||||
/**
|
||||
* The same as the `std::invocable` concept, but also specifying the result
|
||||
* type.
|
||||
@@ -53,7 +61,7 @@ template <typename F, typename Result, typename... Args>
|
||||
concept invocable_returning = requires(F&& f, Result&& result, Args&&... args) {
|
||||
{
|
||||
std::invoke(std::forward<F>(f), std::forward<Args>(args)...)
|
||||
} -> std::convertible_to<Result>;
|
||||
} -> same_or_convertible_to<Result>;
|
||||
};
|
||||
|
||||
// The cannonical overloading template for `std::visitor`, not sure why this
|
||||
|
||||
Reference in New Issue
Block a user