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

3 comments
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 

0
Comment actions Permalink

Hello!

I see you've already filed https://youtrack.jetbrains.com/issue/RSCPP-27460, thanks!  We've fixed the issue and we'll consider backporting it to the 2019.2.2 bugfix release.

0
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.

0

Please sign in to leave a comment.