Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

one single object, but an array of objects ?

array object objects
0
Posted

one single object, but an array of objects ?

0

> >>Call each objects destructor and then a dealloc for the whole array ?[/color] > > > > That’s right.[/color] > > But this is a hassle for me, since I then have to rember the size of > each array (the number of elements in there) or otherwise i would not be > able to delete it correctly. > > My problem is, i’m doing billions (!) of new and delete (and copy ctors) > on small int arrays, which results in quie slow code.[/color] No, it won’t be slow – at least not for the reasons mentioned – because deleting an int is a no-op. You don’t even have to write the explicit dtor call, though. int, like all C types is called a ‘POD’ in C++. That means Plain Old Data. For C compatibility, you can still treat those types like in C.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123