I want to set an element at a specific position of a vector to null, so can do it as the following:
vector<IXMLDOMNodePtr> vec1;// filled somehow
vec1[i] = nullptr;// some specific position i
ps. I want to keep the entry that is nulled, which acts like a place holder, so I think maybe vec[i] = 0 will do?
May be
erase()will help, e.g.When you iterate through next, that entry will not be there…
Now that we know what you want to do, something like this ought to work..
This is without knowing what this
IXMLDOMNodePtris (if it is as the name implies a pointer), then simply setting it to0ought to work.NOTE: If you dynamically allocated this object, setting it to
0does not clear up the memory as setting something tonulldoes in Java – in C++ you have to explicitly clean it up first, i.e.