Original Post
Hey all, Haveing a small problem with STL vectors. First of all, I'm using Visual C++ 2005 express Beta 2; and heres my code The idea of all of this is that i want to create a ring of models, the placement of them seems to be working and they are rendering, as my model class is basically just the .X model class from DirectX samples. What my problem is that while looping thru, adding models to my vector, some of them seem to be filled with junk (addresses like 0xcdcdcdcd or 0xfeeefeee). I then stepped thru my code to fine that pTempModel was being filled correctly, but after i pushed it onto the vector list m_vecModelList it would have a crap address, pass the assert( unsure how this could be possible ), and seems to not give me any errors. Any insight into what the problem could be would be great.
void CRing::Create( LPDIRECT3DDEVICE9 p_pDevice, char* p_strModelName, int p_iNumOfItems, float p_fRadius ) {
//CXModel* pTempModel;
m_fRadius = p_fRadius;
m_iNumOfItems = p_iNumOfItems;
// for each 'item'
for( int i = 0; i < p_iNumOfItems; i++ ) {
// create a model
CXModel* pTempModel = new CXModel();
pTempModel->LoadXModel( p_strModelName, p_pDevice );
// add to vector list
m_vecModelList.push_back( pTempModel ); //<--- Problem seems to be here
assert( m_vecModelList == pTempModel );
pTempModel = NULL;
}
PositionModels();
}