I have a vector of objects which are pointers but when I print the contents out I get memory addresses, so I was going to copy the vector to a string vector but the methods like copy, assign or swap don’t seem to work.
std::vector<BmvMessage*> MsgName;
//std::vector<BmvMessage> MsgNameCopy;
//std::string* a;
MsgName = retrieveMessageNameID(Msg).push_onto(MsgName);
std::vector<BmvMessage*>::iterator it;
for (it = MsgName.begin(); it != MsgName.end(); ++it) {
DCS_LOG_DEBUG("it is not empty");
MsgName.swap(MsgNameCopy);
}
What am I doing wrong?
Iterators are like pointers so ‘it’ is like a pointer to a pointer – deference it and you should be back at your original pointer.