If I have a vector( or a queue) I was wondering what would happen when I pop an element from it. The pointers are assigned to dynamically allocated memory locations. If I pop them , do they call the destructor function of the objects pointed to by the pointer, or is that allocated memory just lost??
Also when I pop an element, Do i get the value or do i get a reference to the object popped.
Please let me know if my question is not clear, I shall provide more details
The pointers are assigned to dynamically allocated memory locations.
What pointers?
If I pop them , do they call the destructor function of the objects pointed to by the pointer, or is that allocated memory just lost??
Still don't know what pointers you are talking about. The popped object destructor will be called for sure. The allocated memory won't lost, it's managed by the underlying container, you don't have to worry about that.
Also when I pop an element, Do i get the value or do i get a reference to the object popped.
As you can see from the links above, both of these return nothing (void).