本文整理汇总了C++中std::hash_map::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ hash_map::erase方法的具体用法?C++ hash_map::erase怎么用?C++ hash_map::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::hash_map
的用法示例。
在下文中一共展示了hash_map::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_Texture
//--------------------------------------------------------------------------------------
CLASS_IMPL_FUNC(D3D10_Factory, get_Texture)(
_Out_ ID3D10ShaderResourceView ** _texture,
_In_ const wchar_t * _directory,
_In_ const D3DX10_IMAGE_INFO ** _info)
{
// 중복 검사
auto iter = g_D3D10Texture_Container.find(_directory);
if (iter != g_D3D10Texture_Container.end())
{
// 이미 있는 경우
(*_texture) = iter->second.texture;
if (_info)
{
(*_info) = &iter->second.info;
}
}
else
{
auto & element = g_D3D10Texture_Container[_directory];
ZeroMemory(&element.info, sizeof(D3DX10_IMAGE_INFO));
// 데이터가 없는 경우
HRESULT hr;
IF_FAILED(hr = D3DX10CreateShaderResourceViewFromFile(
framework::g_Framework_Device.d3d10Device,
_directory,
nullptr,
nullptr,
&element.texture,
nullptr))
{
g_D3D10Texture_Container.erase(_directory);
if (hr != E_INVALIDARG)
{
return create_Texture(_texture, _directory);
}
return hr;
}
D3DX10GetImageInfoFromFile(_directory, nullptr, &element.info, nullptr);
// added one count from AutoRelease
(*_texture) = element.texture;
if (_info)
{
(*_info) = &element.info;
}
}
示例2: afsNewFileFromAFS2
// From here, there is one call per loaded file. The values
// inside the structure can be changed, so that various scenarios
// are possible:
// - replacing a file,
// - changing the file which is loaded to another one from the AFS,
// - both (like for fserv, where the fileId is not valid but a special id)
// - mark a file to be observed until it is unpacked
void afsNewFileFromAFS2(DWORD* fileId)
{
//LogWithNumber(&k_kload, "afsNewFileFromAFS2:: fileId = %08x", *fileId);
lastGetFileInfo = (GETFILEINFO*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(GETFILEINFO));
// Fill the structure
lastGetFileInfo->uniqueId = nextUniqueId;
lastGetFileInfo->isProcessed = false;
lastGetFileInfo->fileId = lastGetFileInfo->oldFileId = *fileId;
lastGetFileInfo->replaceBuf = NULL;
lastGetFileInfo->replaceSize = 0;
lastGetFileInfo->firstPage = 0;
lastGetFileInfo->needsUnpack = false;
GETFILEINFO* gfi = lastGetFileInfo;
nextUniqueId = (nextUniqueId == 0xffffffff)?0 : nextUniqueId + 1;
// This is the call to the modules where parameters can be changed
// only isProcessed and fileId should be changed directly, to replace
// a file with other data, use makeReplaceBuffer() or loadReplaceFile()
for (vector<afsreplace_callback_t>::iterator it = _afsreplace_vec.begin(); it != _afsreplace_vec.end(); it++) {
(*it)(lastGetFileInfo);
}
//LogWithTwoNumbers(&k_kload, "afsNewFileFromAFS2: fileId=%08x, lastGetFileInfo=%08x", *fileId, (DWORD)lastGetFileInfo);
//LogWithTwoNumbers(&k_kload, "afsNewFileFromAFS2: fileId=%08x, gfi=%08x", *fileId, (DWORD)gfi);
if (gfi->fileId != gfi->oldFileId) {
*fileId = gfi->fileId;
LogWithTwoNumbers(&k_kload, "Replace fileId: 0x%x -> 0x%x",
gfi->oldFileId, gfi->fileId);
}
// store in a map for later use
if (gfi->isProcessed && gfi->replaceBuf!=NULL)
_fileInfoMap[gfi->fileId] = gfi;
else
_fileInfoMap.erase(gfi->fileId);
}