I'm trying to understand std::vector, and I know that if vector is a vector containing user-defined classes it's important that it calls its destructors in case that class has "ownership" of a resource. In this case I imagine that it would loop through each element and call the destructor on each.
But in the case of plain old data, I don't think destructors would need to be called, only a simple delete of the entire block. If I had to guess I'd say this would be faster for say, reallocations.
Would it be fairly easy to implement your own array class which distinguishes these two and behaves different according to what needs to be done? Thanks.