P
Philipp Kraus
Hello,
I would like to allocate a lot of objects in a block. I have read that
I can use calloc (and free), but I think it is a C call and I would do
this in C++-style. I need around 100 till 100.000 objects in memory and
I would do this like:
std::vector<myclass> objects;
for(size_t i=0; i < maxsize; ++i)
objects.push_back( myclass(...) );
Is this a correct call in C++ or can I do this in a better way? Within
my algorithm I need iterate over the full vector (and call a method on
each object)
Thanks
Phil
I would like to allocate a lot of objects in a block. I have read that
I can use calloc (and free), but I think it is a C call and I would do
this in C++-style. I need around 100 till 100.000 objects in memory and
I would do this like:
std::vector<myclass> objects;
for(size_t i=0; i < maxsize; ++i)
objects.push_back( myclass(...) );
Is this a correct call in C++ or can I do this in a better way? Within
my algorithm I need iterate over the full vector (and call a method on
each object)
Thanks
Phil