diff --git a/src/lib/settings/source_group/SourceGroupSettingsWithComponents.h b/src/lib/settings/source_group/SourceGroupSettingsWithComponents.h index bb8e5b76..0e9b9277 100644 --- a/src/lib/settings/source_group/SourceGroupSettingsWithComponents.h +++ b/src/lib/settings/source_group/SourceGroupSettingsWithComponents.h @@ -23,7 +23,7 @@ public: SourceGroupSettings::load(config, key); using expand_type = int[]; - expand_type a{ 0, ((ComponentTypes::load(config, key)), void(), 0)... }; + expand_type a{ 0, loadHelper(config, key)... }; } void saveSettings(ConfigManager* config) override @@ -33,7 +33,7 @@ public: SourceGroupSettings::save(config, key); using expand_type = int[]; - expand_type a{ 0, ((ComponentTypes::save(config, key)), void(), 0)... }; + expand_type a{ 0, saveHelper(config, key)... }; } bool equalsSettings(const SourceGroupSettingsBase* other) override @@ -51,7 +51,7 @@ public: } using expand_type = int[]; - expand_type a{ false, ComponentTypes::equals(other)... }; + expand_type a{ false, equalsHelper(other)... }; bool r = true; for (size_t i = 1; i <= getComponentCount(); ++i) @@ -67,6 +67,26 @@ private: { return sizeof...(ComponentTypes); } + + template + bool loadHelper(const ConfigManager* config, const std::string& key) + { + T::load(config, key); + return true; + } + + template + bool saveHelper(ConfigManager* config, const std::string& key) + { + T::save(config, key); + return true; + } + + template + bool equalsHelper(const SourceGroupSettingsBase* other) + { + return T::equals(other); + } }; #endif // SOURCE_GROUP_SETTINGS_WITH_COMPONENTS_H