L
Lasse Skyum
I'm currently learning STL and I hate not knowing what is gooing on "inside"
STL... not because I really _need_ to know it to develop my game project,
but that's just my nature... like most of you at this grounp I suspect.
So the question is:
How does a std::vector construct and destruct the elements in it? I know it
has something to do with an allocator...
Suppose I wrote:
CMyClass *pDynArray = (CMyClass*)malloc(sizeof(CMyClass)*100);
Would it then be posible to construct/destruct the elements one by one in
that array?
I know that this constructs 100 elements at once:
CMyClass *pArray = new CMyClass[100];
.... but acording to my tests std::vector doesn't seem to use that aproach.
STL... not because I really _need_ to know it to develop my game project,
but that's just my nature... like most of you at this grounp I suspect.
So the question is:
How does a std::vector construct and destruct the elements in it? I know it
has something to do with an allocator...
Suppose I wrote:
CMyClass *pDynArray = (CMyClass*)malloc(sizeof(CMyClass)*100);
Would it then be posible to construct/destruct the elements one by one in
that array?
I know that this constructs 100 elements at once:
CMyClass *pArray = new CMyClass[100];
.... but acording to my tests std::vector doesn't seem to use that aproach.