I have a std::map<std::string, HANDLE> SampleMap which stores HANDLE objects as value. After the use of the map I am clearing all the map entries.
SampleMap.clear();
By doing so what happens to the handle objects. Is they get deleted?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
HANDLE are just typedefs or defines to pointers (AFAIK
void*).When clearing the map they will not get deleted you have to close/release them yourself.
Or write a wrapper class that will do that for you. See this thread How to use C++ standard smart pointers with Windows HANDLEs? for a few starting ideas.