I've been running into a problem where calling std::vector.clear() on a large vector, n > 1,000,000 takes a many seconds.
It is currently std::vector of structs, which are basically POD. There is no clean up needed in the destructor. I've considered changing the structs to classes, because I wanted to add some functions to them, but I'm not sure how that will impact calling clear on vectors of large numbers of these classes/struct.
It boils down to wanting to know when std::vector.clear() will call a destructor. I was under the impression that these days there is no difference between a class and a struct in C++ other than struct members default to public.
I would hate to have to switch to using malloc, realloc and free myself and keeping track of the size just because I want to guarantee that destructors aren't being called, but it seems like I'm taking a performance hit even when calling clear().