I have some code that loops and news up some pointers and stores them in a vector:
std::vector<InputBox*> m_octets;
...
InputBox* octet = new InputBox(rect, title, touch_num);
m_octets.push_back(octet);
In the class destructor I for_each
over m_octets
and invoke the destructor for each pointer. I think this is all good. It all compiles and the unit tests pass. The problem is Gimpel's PC-lint doesn't like it. It sees that `octet' is a custodial pointer that has not been freed (Warning 429). I can of course disable that warning but the manual (11.2.1) indicates there is a semantic for this. I would have thought would work:
-sem(*push_back, custodial (1))
Unfortunately it has no effect. I've tried various combinations including fully specifying m_octets.push_back
but nothing seems to work. Does anybody know the proper form of this command for the example given?
This one works fine for me: -sem(std::vector::push_back, custodial(1))