cArray Upgrades Part 4
Hello again,
Yes, more improvements in the cArray class. First I found a gaping hole in the Copy method. When copying back into the same array and the destination falls within the source range of elements, it ends up copying the same element over and over. I thought the SafeArrayCopyData method was smarter, my bad. So now I've rewritten the entire copy section. It is optimized for value datatypes such as Longs. It correctly copies back into the same array. The UDT arrays have to match, and objects in the source array must be compatible with the destination array. This is checked on each object as it is attempted to be copied.
And of course, what would an upgrade be without the ability to shoot yourself in the foot? In the Copy methods there is the ability to pass in an address of a copy method that can be used to assign an element from the source array to the destination array. This allows for developers to perform custom assignments between the source and destination arrays.
Yes, more improvements in the cArray class. First I found a gaping hole in the Copy method. When copying back into the same array and the destination falls within the source range of elements, it ends up copying the same element over and over. I thought the SafeArrayCopyData method was smarter, my bad. So now I've rewritten the entire copy section. It is optimized for value datatypes such as Longs. It correctly copies back into the same array. The UDT arrays have to match, and objects in the source array must be compatible with the destination array. This is checked on each object as it is attempted to be copied.
And of course, what would an upgrade be without the ability to shoot yourself in the foot? In the Copy methods there is the ability to pass in an address of a copy method that can be used to assign an element from the source array to the destination array. This allows for developers to perform custom assignments between the source and destination arrays.
0 Comments:
Post a Comment
<< Home