class MyMap : std::map<char, pro::image>
{
public:
void MyMethod(char x);
/** code **/
}
void MyMap::MyMethod(char x)
{
pro::image my_img; // note that my_img is a local variable
my_img.LoadFromFile("my_image.png");
this->insert(std::pair<char, pro::image>(x, my_img)); // stored in the class
}
Now, is this code safe? Basically, does MyMap store a copy of my_img when I insert it, or does it store a reference?
It will store a copy.
However, do you really need inheritance? You should make the
std::mapa class member.