Skip to content

Commit

Permalink
feat: add optional default argument
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix committed Oct 12, 2023
1 parent 1eabd73 commit 2289971
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/I/INISettingCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ namespace RE
}

template <class T>
T GetSetting(const std::string_view a_name, T a_fallback)
T GetSetting(const std::string_view a_name, T a_fallback, const bool a_default = false)
{
if (auto setting = GetSetting(a_name)) {
return setting->GetValue(a_fallback);
return setting->GetValue(a_fallback, a_default);
}

return a_fallback;
Expand Down
4 changes: 2 additions & 2 deletions CommonLibSF/include/RE/R/RegSettingCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ namespace RE
}

template <class T>
T GetSetting(const std::string_view a_name, T a_fallback)
T GetSetting(const std::string_view a_name, T a_fallback, const bool a_default = false)
{
if (auto setting = GetSetting(a_name)) {
return setting->GetValue(a_fallback);
return setting->GetValue(a_fallback, a_default);
}

return a_fallback;
Expand Down

0 comments on commit 2289971

Please sign in to comment.