Change the declaration of the getter std:function passed to registerLegacySkyFn to return a T rather than a T const &.

For the lambdas they return a temporary 'T' rather than a 'T const&'. Binding any reference to this is illegal.
meow-7.2.2
Nicky 2020-07-15 22:14:02 +02:00
parent 88c5c9707c
commit 06fb655080
2 changed files with 2 additions and 2 deletions

View File

@ -672,7 +672,7 @@ void RlvEnvironment::registerSetEnvFn(const std::string& strFnName, const std::f
}
template<typename T>
void RlvEnvironment::registerLegacySkyFn(const std::string& strFnName, const std::function<const T& (LLSettingsSkyPtr_t)>& getFn, const std::function<void(LLSettingsSkyPtr_t, const T&)>& setFn)
void RlvEnvironment::registerLegacySkyFn(const std::string& strFnName, const std::function< T (LLSettingsSkyPtr_t)>& getFn, const std::function<void(LLSettingsSkyPtr_t, const T&)>& setFn)
{
RLV_ASSERT(m_LegacyGetFnLookup.end() == m_LegacyGetFnLookup.find(strFnName));
m_LegacyGetFnLookup.insert(std::make_pair(strFnName, [this, getFn](const std::string& strRlvParam, U32 idxComponent)

View File

@ -45,7 +45,7 @@ protected:
void registerGetEnvFn(const std::string& strFnName, const std::function<std::string(LLEnvironment::EnvSelection_t env)>& getFn);
template<typename T> void registerSetEnvFn(const std::string& strFnName, const std::function<ERlvCmdRet(LLEnvironment::EnvSelection_t env, const T& strRlvOption)>& setFn);
template<typename T> void registerSkyFn(const std::string& strFnName, const std::function<T(LLSettingsSky::ptr_t)>& getFn, const std::function<void(LLSettingsSky::ptr_t, const T&)>& setFn);
template<typename T> void registerLegacySkyFn(const std::string& strFnName, const std::function<const T& (LLSettingsSky::ptr_t)>& getFn, const std::function<void(LLSettingsSky::ptr_t, const T&)>& setFn);
template<typename T> void registerLegacySkyFn(const std::string& strFnName, const std::function< T (LLSettingsSky::ptr_t)>& getFn, const std::function<void(LLSettingsSky::ptr_t, const T&)>& setFn);
// Command handling helpers
template<typename T> std::string handleGetFn(const std::function<T(LLSettingsSky::ptr_t)>& fn);