I have a code snippet that works fine with MSVC but doesn't compile with clang ++
void MyCass::someMethod()
{
std::wstring key(...);
auto& refInstance = m_map.find(key);
}
where m_map is defined as
std::map<const std::wstring, std::shared_ptr<IInterface>> m_map;
and clang complains
non-const lvalue reference cannot bind to incompatible temporary
I understand somewhat that a temporary one is being created, but I'm not sure how to fix it. Any ideas?
source
share