typedef boost::smart_ptr
// this does not work->nasty memory leak
RefString rsUnitName = RefString(new std::string((*i)->pType->unitType));
RefString rsInstanceName = RefString(new std::string((*i)->unitObjectName));
refMapUnitNameUnitInstName.get()->operator [](rsUnitName) = rsInstanceName;
refMapUnitNameUnitInstName->insert(std::make_pair(rsUnitName, rsInstanceName));
refMapUnitNameUnitInstName->insert(std::pair
// this also causes a memory leak.
// pair can't figure out the size of the objects pointed to by the RefString for some reason
// and assigns a default of 8-bits
refMapUnitNameUnitInstName->insert(std::pair
RefString(new std::string((*i)->unitObjectName)))
);
// THIS WORKS!
// New the objects inside of the smart pointer wrapper that passed the types to std:pair
refMapUnitNameUnitInstName->insert(std::pair
RefString(new std::string((*i)->unitObjectName)))
);
No comments:
Post a Comment