Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #9923
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | block allocation |
| Date | 2011-09-08 15:57 +0200 |
| Organization | 1&1 Internet AG |
| Message-ID | <j4ahk9$ca9$1@online.de> (permalink) |
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
Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread
block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 15:57 +0200
Re: block allocation Goran <goran.pusic@gmail.com> - 2011-09-08 07:32 -0700
Re: block allocation Asger-P <junk@asger-p.dk> - 2011-09-08 16:42 +0200
Re: block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 16:50 +0200
Re: block allocation Noah Roberts <roberts.noah@gmail.com> - 2011-09-08 08:09 -0700
Re: block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 17:15 +0200
Re: block allocation Victor Bazarov <v.bazarov@comcast.invalid> - 2011-09-08 11:27 -0400
Re: block allocation Asger-P <junk@asger-p.dk> - 2011-09-08 17:46 +0200
Re: block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 17:52 +0200
Re: block allocation Asger-P <junk@asger-p.dk> - 2011-09-08 18:35 +0200
Re: block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 20:04 +0200
Re: block allocation Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-08 20:27 +0000
csiph-web