summaryrefslogtreecommitdiff
path: root/src/utils.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-11-21 11:15:08 +1100
committerMaxime Coste <mawww@kakoune.org>2021-11-21 11:41:50 +1100
commit91550639bbbd20c92957b83abfbb3ec4c43b3ab4 (patch)
tree6559c52e84e7e1abef540cf0636f322c1e5acbea /src/utils.hh
parentcd2172eed6dd7aca7c24972e4dac0258e19c070b (diff)
More C++20 refactorings
Use CTAD instead of make functions, requires instead of enable_if
Diffstat (limited to 'src/utils.hh')
-rw-r--r--src/utils.hh10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils.hh b/src/utils.hh
index 818cf957..a405659b 100644
--- a/src/utils.hh
+++ b/src/utils.hh
@@ -173,11 +173,11 @@ public:
}}
{}
- template<typename Target,
- typename = std::enable_if_t<
- not std::is_same_v<FunctionRef, std::decay_t<Target>> and
- std::is_convertible_v<decltype(std::declval<Target>()(std::declval<Args>()...)), Res>
- >>
+ template<typename Target>
+ requires requires (Target t, Args... a) {
+ requires not std::is_same_v<FunctionRef, std::remove_cvref_t<Target>>;
+ { t(a...) } -> std::convertible_to<Res>;
+ }
FunctionRef(Target&& target)
: m_target{&target},
m_invoker{[](void* target, Args... args) {