Merge pull request #37 from QuasarApp/task_111_fix

Added change in template method instance
This commit is contained in:
Igor loschinin 2021-11-08 23:22:29 +03:00 committed by GitHub
commit 0c04d41712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,13 +40,13 @@ public:
* @brief instance This method return instance of the settings object * @brief instance This method return instance of the settings object
* @return pointer to a settings object; * @return pointer to a settings object;
*/ */
template <class SettingsType> template <class SettingsType, class... Args>
static ISettings* instance() { static ISettings* instance(Args&&... args) {
static_assert (std::is_base_of<SettingsType, ISettings>::value, static_assert (std::is_base_of<ISettings, SettingsType>::value,
"the Settingstype type must be ISettings"); "the Settingstype type must be ISettings");
if(!_settings){ if(!_settings){
_settings = new SettingsType(); _settings = new SettingsType(std::forward<Args>(args)...);
} }
return _settings; return _settings;