Things like window handles, bitmap handles, mutexes, etc, etc.
Printable View
Things like window handles, bitmap handles, mutexes, etc, etc.
>> this seems like it could be a lot cleaner in C++.
Using vectors would be a lot cleaner in C++. You wouldn't have to worry about the potential bugs that exist in either version.
is a vector of much use if the collection is of a fixed size?
and on that note...@OP:
are your data sets always 6000 elements, or are you just always allocating the maximum amount you'd need?
It will still get rid of the need to delete what you allocated, which can get tricky in large programs.
Plus it can perform bounds checking, which helps you find bugs.
>> is a vector of much use if the collection is of a fixed size?
If they are dynamically allocated, yes. Three immediate examples are:
- The potential errors from the lack of a copy constructor and copy assignment operator in your struct would not be a problem because the default (compiler generated) versions of those functions would work correctly with vectors.
- The potential memory leak in your code when an allocation fails in the constructor would not happen with vectors.
- You would not need to write your own destructor.
For non-dynamically allocated arrays I would consider std::tr1::array for the bounds checking and size advantages.