CFastMap의 특정 key의 value값만 삭제하는 코드

key : hostID / value : inventory class 를 갖는 CFastMap의 구현에서 특정 key의 value값만 클리어 하고 싶을 때 코드를 어떻게 작성해야 하는지 문의 드립니다.

class CInventory

{

public:

CInventory(void) {}

~CInventory(void)

{

m_playerBoxList.Clear();

m_equipMentList.Clear();

}

public:

CFastList<CPlayerBox> m_playerBoxList;

CFastList<CEquipMentBox> m_equipMentList;

};

typedef RefCount<CInventory> CInventoryPtr;

typedef CFastMap<HostID, CInventoryPtr> RemoteInventory;

RemoteInventory m_remoteInventories;

...

CInventoryPtr Inven(new CInventory);

m_remoteInventories.Add(remote0, Inven);

m_remoteInventories.Add(remote1, Inven);

여기에서 remote1 자체를 삭제 하지 않고 remote1의 Inven만 삭제하고 새로 넣어주는 코드를 어떻게 구현해야 되나요?

CFastMap.RemoveKey 함수로 제거하시고, CFastMap.Add로 다시 추가하거나 CFastMap<HostID, std::share_ptr<CInventory>>로 변경하시고, CFastMap.TryGetValue로 share_ptr를 가져오신 뒤 새로운 Inventory 객체를 가리키는 shared_ptr를 대입 하는 것도 방법일 것 같습니다.