Skip to content

Commit b70c163

Browse files
committed
🔧 [mph] concepts::invocable
1 parent fcb87b9 commit b70c163

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ template<info meta> using type_of = /* unspecified */;
187187
* typeid(apply<variant>([] { return vector{meta<int>}; })));
188188
* @endcode
189189
*/
190-
template<template<class...> class T, class Expr>
191-
[[nodiscard]] constexpr auto apply(Expr expr);
190+
template<template<class...> class T>
191+
[[nodiscard]] constexpr auto apply(concepts::invocable auto expr);
192192
```
193193
194194
```cpp

mp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ template<size_t N> using make_index_sequence =
3636
namespace concepts {
3737
template<class TRange>
3838
concept range = requires(TRange range) { range.begin(); range.end(); };
39+
template<class Fn, class... TArgs>
40+
concept invocable = requires (Fn fn, TArgs... args) { fn(args...); };
3941
} // namespace concepts
4042

4143
/**
@@ -166,7 +168,7 @@ using type_of = typename decltype(get(detail::meta_type<meta>{}))::value_type;
166168
* @endcode
167169
*/
168170
template<template<class...> class T>
169-
[[nodiscard]] constexpr auto apply(auto expr) {
171+
[[nodiscard]] constexpr auto apply(concepts::invocable auto expr) {
170172
constexpr concepts::range auto range = expr();
171173
return [range]<size_t... Ns>(utility::index_sequence<Ns...>) {
172174
return T<type_of<range[Ns]>...>{};

0 commit comments

Comments
 (0)