이전게시판/C, C++
c++ stl Map 동적할당 delete 해제 예제
ㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇ
2024. 10. 4. 16:15
map<int, GameObject*> gameObjects;
// 동적 할당 해제
for (map<int, GameObject*>::iterator it = gameObjects.begin(); it!= gameObjects.end(); it++) {
delete it->second;
}
gameObjects.clear();