Cache APP_SETTINGS lookups

These are essentially singletons
This commit is contained in:
Jon Evans 2021-03-16 20:46:58 -04:00
parent 045160d486
commit 5e6b02f2d3
1 changed files with 4 additions and 1 deletions

View File

@ -85,7 +85,10 @@ public:
template<typename AppSettings>
AppSettings* GetAppSettings( bool aLoadNow = true )
{
AppSettings* ret = nullptr;
static AppSettings* ret = nullptr;
if( ret )
return ret;
auto it = std::find_if( m_settings.begin(), m_settings.end(),
[]( const std::unique_ptr<JSON_SETTINGS>& aSettings )