F
Flzw
I finally decided to start using those, I think I have a good enough idea of
how they work, but I still have a few questions
First, is an iterator really a pointer to an item, I mean, will this work :
std::list <CObject> ObjectList;
CObject* NewObject()
{
ObjectList.push_back( CObject());
return (CObject*) (ChanList.end() - 1;
}
I saw that vectors use adjacent memory, meaning that if I have a pointer to
one of its elements, if a previous element gets erased it won't be pointing
to the good element anymore (possibly even points to garbage)
I'm using list because I think I read it doesnt do that, but I would find
the find() member of map useful, I supposes map works more like list but I
wanted a confirmation.
Thanks for answering and poining me out if I understood something wrong.
how they work, but I still have a few questions
First, is an iterator really a pointer to an item, I mean, will this work :
std::list <CObject> ObjectList;
CObject* NewObject()
{
ObjectList.push_back( CObject());
return (CObject*) (ChanList.end() - 1;
}
I saw that vectors use adjacent memory, meaning that if I have a pointer to
one of its elements, if a previous element gets erased it won't be pointing
to the good element anymore (possibly even points to garbage)
I'm using list because I think I read it doesnt do that, but I would find
the find() member of map useful, I supposes map works more like list but I
wanted a confirmation.
Thanks for answering and poining me out if I understood something wrong.