stl pairs question

Feb 20, 2011 at 5:50pm
I know that unless you change the default allocator, STL containers generally store their elements on the free store and perform their own memory management. Does anyone know, however, if one creates STL pair<T, T> objects that are not inserted into a container, whether or not those objects will automatically be removed from the free store? In other words, if I create a pair using pair() or make_pair(), do I need to call delete?
Feb 20, 2011 at 6:31pm
if I create a pair using pair() or make_pair(), do I need to call delete?
No.
Feb 20, 2011 at 6:45pm
if T is a pointer type, std::pair<> will NOT call delete on the pointer(s) when it is destroyed.
Topic archived. No new replies allowed.