CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2010
    Posts
    907

    Cannot insert into unordered_map

    I am getting access violation for the insertion, why is that?
    Should be okay...
    Any ideas?
    Thanks
    Jack

    Code:
    for (DWORD iBone = 0; iBone < dwNumBones; iBone++)
    {
    	const D3DXMATRIX& offsetMat = *(pMeshContainer->pSkinInfo->GetBoneOffsetMatrix(iBone));
    	pMeshContainer->m_boneOffsetMatrices.insert(std::make_pair(iBone, offsetMat));
    }
    
    struct MESHCONTAINER : public D3DXMESHCONTAINER
    {
    public:
    	~MESHCONTAINER()
    	{
    	}
    	LPDIRECT3DTEXTURE9*  ppTextures;       // array of textures, entries are NULL if no texture specified    
    
    	// SkinMesh info             
    	LPD3DXMESH				pOrigMesh;
    	LPD3DXATTRIBUTERANGE	pAttributeTable;
    	DWORD					dwNumAttributeGroups;
    	DWORD					dwNumInfl;
    	DWORD					dwNumBones;
    	LPD3DXBUFFER		    	        pBoneCombinationBuf;
    	D3DXMATRIX**			        ppBoneMatrixPtrs; 
    	std::unordered_map<int, D3DXMATRIX> m_boneOffsetMatrices;
     
    
     
    };

  2. #2
    Join Date
    Nov 2003
    Posts
    1,902

    Re: Cannot insert into unordered_map

    I would step into GetBoneOffsetMatrix and make sure it is returning a valid pointer. You could also remove the reference and step into the copy-constructor of offsetMat to see if the problem is there (which would imply a bad pointer being returned).

    gg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured