There are no overload of
std::map::insert that takes a key and a value.
You can use
operator to add a new element:
mp[key] = *obj;
std::map::insert_or_assign since C++17:
Another point is that type of
test* while the type of values of the map
mp has type
test. The pointer should be dereferenced (like my examples above) or the type of values should be changed to pointers to do this insertion.
CLICK HERE to find out more related problems solutions.