realloc(...) like function in C++
-
Hi, I can't find any way to resize class arrays created using "new" is it right to use C memory allocation functions for class arrays and then call constructors/destructors :confused:
You definitely wouldn't want to use realloc with an object created with new. You need to leave that old C stuff behind. If you are using MFC CArray or better still STL vector then they will resize themselves as required. Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
-
You definitely wouldn't want to use realloc with an object created with new. You need to leave that old C stuff behind. If you are using MFC CArray or better still STL vector then they will resize themselves as required. Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
-
Hi, I can't find any way to resize class arrays created using "new" is it right to use C memory allocation functions for class arrays and then call constructors/destructors :confused:
If you're using MFC, you can use
SetSize()
to preallocate aCArray
's storage. This is useful when optimizing deserialization of a collection. The size of the collection will grow as you add more elements. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com