Sure, but we're not talking about a free object here. We're talking about a vector and a map which takes a pointer of type CIndex* and pIndex in the function is const CIndex* const, so basically you'd be throwing away the const.
Function:
Code:
ERROR1 CRegistry::AddIndex(const CIndex* const pIndex, UINT* const pVectorIndex, const bool bLoadingNow) const
{
// Save index in list
CHive& rHive = GetHive();
rHive.m_vIndexes.push_back(pIndex); // ERROR
if (!bLoadingNow) CHECK_IF_ERROR_1( UpdateIndexInfo(pIndex) ); // Update index information in index file
rHive.m_IndexByID.SetAt(pIndex->dwId, pIndex); // ERROR
pIndexB = NULL;
if (pVectorIndex) *pVectorIndex = (rHive.m_vIndexes.end() - rHive.m_vIndexes.begin());
return ERROR_SUCCESS;
}
GetHive() return a CHive as you can see.
Declaration of CHive:
Code:
class CHive
{
friend class CRegistry;
mutable vector<CIndex*> m_vIndexes;
vector<CIndex*> m_vFreeBlocks;
vector<CIndex*> m_vIndexToUpdate;
mutable CTypedPtrMap<CMapWordToPtr, UINT64, CIndex*> m_IndexByID;
CIndex* pRoot; // The root index item
UINT64 nFreeId; // SAVE
UINT64 nLastOffset; // SAVE
};