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?
>> 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.
Last edited by Daved; 06-02-2008 at 01:45 PM.