I have a method inside a class that works fine, but someone told me that there are two ways that I provide results and that AddString returns string + updates a_Data parameter. This is the code in my method:
First, a_Data is not updated or rather a_Data is updated but it's just a local copy of a pointer, so the change isn't propagated to the calling code -- this is perfectly fine, if unnecessary. Second, it doesn't appear you actually want a map of std::string pointers or if ( data == *(iter->first)) wouldn't be in your code.
If you did actually want the map indexed on std::string*, the following would probably be just fine.
Yea the purpose of the method is to compare the strings where the pointers point and then act accordingly.
But how do you think i should call the method? Is this uneccesary? m_Data = g_StrMgr.AddString(m_Data);