desocupado
Magister
- Joined
- Nov 17, 2008
- Messages
- 1,802
C++
Say I call a function, and inside that function I create a pointer to something, store it in a vector (vector was passed by reference, so it exists after the function call is over) and then quit the function call.
The pointer created exists only inside the vector now, since it was created inside the function's scope.
If I just remove the pointer from the vector using vector.erase(begin()+position), does the memory alocated by whatever that pointer points to is liberated?
Say I call a function, and inside that function I create a pointer to something, store it in a vector (vector was passed by reference, so it exists after the function call is over) and then quit the function call.
The pointer created exists only inside the vector now, since it was created inside the function's scope.
If I just remove the pointer from the vector using vector.erase(begin()+position), does the memory alocated by whatever that pointer points to is liberated?