Whisper Memory Fix in Bug Fixes Posted October 21, 2023 On 10/16/2023 at 6:02 PM, Chookez said: A slightly more optimized code for the second solution. CWhisper* CPythonChat::CreateWhisper(const char* c_szName) { auto itor = m_WhisperMap.find(c_szName); CWhisper* pWhisper; if (itor == m_WhisperMap.end()) { pWhisper = CWhisper::New(); m_WhisperMap.emplace(c_szName, pWhisper); } else { pWhisper = itor->second; } return pWhisper; } I'm sorry to bother you. I would consider this to be a "optimization": CWhisper* CPythonChat::CreateWhisper(const char* c_szName) { auto [itor, inserted] = m_WhisperMap.try_emplace(c_szName, nullptr); if (inserted) { itor->second = CWhisper::New(); } return itor->second; } Best regards 1 1
Whisper Memory Fix
in Bug Fixes
Posted
I would consider this to be a "optimization":
CWhisper* CPythonChat::CreateWhisper(const char* c_szName) { auto [itor, inserted] = m_WhisperMap.try_emplace(c_szName, nullptr); if (inserted) { itor->second = CWhisper::New(); } return itor->second; }
Best regards