Array of list::iterator

Hi guys. I am trying to making an array of list::<PointObj>::iterator, so this is what I did:
PointListIter* pointIterArr= (PointListIter*) malloc(1000*sizeof(PointListIter));


where PointListIter is std::list<PointObj*>::iterator

However I cannot assign an iterator to the any element of the array. When I run a for loop:
1
2
3
4
for (PointListIter i= pointList.begin(); i!= pointList.end(); i++)
{
pointIterArr[count++]= i;
}


it crashed at the first iterator. Could anyone please tell me if I am doing something wrong here? Thanks =)
Could anyone please tell me if I am doing something wrong here?
Yeah. You're using malloc() to allocate objects.
HI helios, thanks, may I know how I can fix this?
Use new instead.
That works, thank you.
Topic archived. No new replies allowed.