Error with unordered_map and shared_ptr

When using unordered_map together with shared_ptr like this:


std::unordered_map<std::shared_ptr<A>,std::shared_ptr<B>> map;

A a;

B b;

map[a] = b;

Resharper C++ analysis gives an error information:

No "operator []" matches arguments of type XXXXXX

Comment actions Permalink

Correct my example:

shared_ptr<A> a = make_shared<A>();

B ...

I'm sure I used it correctly because without resharper I didn't get any error information.


And I have to add that it is a linux project. I tried  creating a normal vs project, and the issue disappeared. The implemention of unordered_map caused this issue is

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\Linux\include\usr\include\c++\5\bits

And normal implemention is 

Comment actions Permalink


I see you've already filed, thanks!  We've fixed the issue and we'll consider backporting it to the 2019.2.2 bugfix release.

Comment actions Permalink

Impressive efficiency! Thank you. And I just find another issue related with linux standard library, I'll file it to issue tracker too.


Please sign in to leave a comment.