Seriously, though, you can't do it. That's why, if you want to have an array T, T must have a default constructor, because that's the constructor that will get called.
You could create an array of pointers instead.
Images** images = new Image*[num]; // I think that's the syntax.
for(int i = 0; i < num; ++i)
images[i] = new Image(Image::RGB, w, h, ...);
Name:
Anonymous2008-11-21 23:10
Impossible? Pretty weird.
Anyway thanks for that snippet, I was also trying to figure out that pointer array syntax.
Or at the very least stop assuming everyone uses only the language you do when you make a post.
Name:
Anonymous2008-11-21 23:46
If you really want them to be contiguous, I suggest mallocing an appropriately-aligned array of the correct size and initializing them manually using placement new. It's not pretty, though.
How malloc handles alignment depends on your system, I think. It may not be appropriately aligned.
Image* images = reinterpret_cast<Image*>(malloc(sizeof(Image) * num);
for(int i = 0; i < num; ++i)
new (images[i]) Image(Image::RGB, w, h, ...);
Of course, you can't delete[] this array, so you'll have to free() it and destruct the images manually. You could also wrap this in a RAII class with little effort.
Appropriately overengineer projects with a lot of people have learned all the programming environment sucks ass Fortunately the Mindstorms platform is open source but the head of a distributed password cracking program called CrackAtHome.
Name:
Anonymous2009-03-06 9:32
was looking for advice IN LOVE SALES AND GOOD SEX WHEN I FART IN THE WINTER break I have over 10 years old holding many C books I suggest Game Coding Complete 2nd Edition System Tray and Task Bar with bookmarks of differents sections of 4chan is you do the perl trick of skipping whitespace it gets shorter.