summaryrefslogtreecommitdiff
path: root/src/string_utils.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-11-11 21:43:27 +1100
committerMaxime Coste <mawww@kakoune.org>2021-11-21 09:44:56 +1100
commitfb4cef5b61639c507e6c5740cc5973d0d79ba673 (patch)
tree751e533a39d9a51be6b8af9e4abe6af75df00e87 /src/string_utils.hh
parent04f11c2af3e0ecdc78df9800d381b2fdc46af3b7 (diff)
Replace std::enable_if with requires
Introduce some concepts for enum and flags handling, goodbye and thanks for all the fish std::enable_if.
Diffstat (limited to 'src/string_utils.hh')
-rw-r--r--src/string_utils.hh8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/string_utils.hh b/src/string_utils.hh
index e0adc181..a11aaa91 100644
--- a/src/string_utils.hh
+++ b/src/string_utils.hh
@@ -136,14 +136,12 @@ decltype(auto) to_string(const StronglyTypedNumber<RealType, ValueType>& val)
namespace detail
{
-template<typename T> constexpr bool is_string = std::is_convertible<T, StringView>::value;
+template<typename T> requires std::is_convertible_v<T, StringView>
+StringView format_param(const T& val) { return val; }
-template<typename T, class = std::enable_if_t<not is_string<T>>>
+template<typename T> requires (not std::is_convertible_v<T, StringView>)
decltype(auto) format_param(const T& val) { return to_string(val); }
-template<typename T, class = std::enable_if_t<is_string<T>>>
-StringView format_param(const T& val) { return val; }
-
}
String format(StringView fmt, ArrayView<const StringView> params);