@@ -48,6 +48,11 @@ concept trivially_copy_assignable = copy_assignable<T> and std::is_trivially_cop
48
48
export template <typename T>
49
49
concept trivially_swappable = std::is_trivially_copyable_v<T> and std::is_trivially_copy_assignable_v<T> and std::is_trivially_destructible_v<T>;
50
50
51
+ export template <typename Function, typename Return, typename ... Args>
52
+ concept invocable_r = requires (Function function) {
53
+ { function (declval<Args>()...) } -> convertible_to<Return>;
54
+ };
55
+
51
56
} // namespace bounded
52
57
53
58
static_assert (bounded::constructible_from<void , void >);
@@ -69,3 +74,11 @@ static_assert(!bounded::convertible_to<void, int>);
69
74
static_assert (!bounded::convertible_to<unsigned long long *, unsigned long long >);
70
75
static_assert (!bounded::convertible_to<unsigned long long , unsigned long long *>);
71
76
static_assert (!bounded::convertible_to<int *, unsigned *>);
77
+
78
+ static_assert (bounded::invocable_r<void (*)(), void >);
79
+ static_assert (!bounded::invocable_r<void (*)(int ), void >);
80
+ static_assert (bounded::invocable_r<void (*)(int ), void , int >);
81
+ static_assert (bounded::invocable_r<bool (*)(), bool >);
82
+ static_assert (!bounded::invocable_r<bool (*)(int ), bool >);
83
+ static_assert (bounded::invocable_r<bool (*)(int ), bool , int >);
84
+ static_assert (bounded::invocable_r<int (*)(unsigned ), bool , int >);
0 commit comments