#include <iostream>
#include <unordered_map>
using namespace std;
class A{};
int main()
{
cout<<"Hello World";
std::unordered_map<A*, int> dic ;
const A* a;
auto it = dic.find(a);
return 0;
}
this code complains "error: invalid conversion from ‘const A*’ to ‘std::unordered_map::key_type’ {aka ‘A*’} [-fpermissive]"
I can not understand it, the cpp refreence https://en.cppreference.com/w/cpp/container/unordered_map/find
says I can find a const Key& key
, so I think const A*
could be used to find A*
, but It does not work