From 7fa22639888d39e43e655632d95450b894c1c5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sun, 3 Sep 2023 15:42:45 +0200 Subject: [PATCH] Use std::enable_if_t in ConfigObject --- src/preferences/configobject.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/preferences/configobject.h b/src/preferences/configobject.h index f2a7059b27e8..a688f51b7a89 100644 --- a/src/preferences/configobject.h +++ b/src/preferences/configobject.h @@ -154,10 +154,9 @@ template class ConfigObject { // Sets the value for key to ValueType(value), over-writing pre-existing // values. ResultType is serialized to string on a per-type basis. - template + template, bool> = true> void setValue(const ConfigKey& key, const ResultType& value); - template - requires std::is_enum_v + template, bool> = true> // we need to take value as const ref otherwise the overload is ambiguous void setValue(const ConfigKey& key, const EnumType& value) { setValue(key, static_cast(value)); @@ -175,11 +174,10 @@ template class ConfigObject { // Returns the value for key, converted to ResultType. If key is not present // or the value cannot be converted to ResultType, returns default_value. - template + template, bool> = true> ResultType getValue(const ConfigKey& key, const ResultType& default_value) const; QString getValue(const ConfigKey& key, const char* default_value) const; - template - requires std::is_enum_v + template, bool> = true> EnumType getValue(const ConfigKey& key, const EnumType& default_value) const { // we need to take default_value as const ref otherwise the overload is ambiguous return static_cast(getValue(key, static_cast(default_value)));