I assume strtype is defined as follows:
typedef char * strtype
Your problem is that you assume that vname and bvar have the same value, where in reality they have different values, each of which points to a memory block that contains identical data.
std::map stupidly compares them with ==, and I'm sure you will find that if you compared them with ==, you would get a lie, as expected. Why exactly do you use the std::string class?
Edit: I rewrote your method to be less scary:
// implied using namespace std; string ScrummyConfigure::removeVariableOrSomething(string tstring) { uint begin; // I'll assume uint is a typedef to unsigned int uint end; begin = tstring.find('$', 0); end = tstring.find('}', begin); string vname = tstring.substr(begin + 2, end - 2); // this is supposedly BASE assert(vname == "BASE"); // this should be true if vname actually is BASE out(this->conf->subvars[bvar]); // wherever theconf used to be, its now a member out(this->conf->subvars[vname]); // of ScrummyConfigure and its been renamed to conf uint size = end - begin; tstring.erase(begin, size); return tstring; // no casting necessary }
source share