Simple Question memset(vector<int>, 0, sizeof(vector<int>))
For some reason I'm having a brain cramp. I'm guessing this is really bad due to the functions within the vector class, but figured I might as well query "the mob".
Code:
#include <vector>
struct foo
{
std::vector<int> fooVec;
};
foo var1;
memset(&var1, 0, sizeof(foo));
Bad, okay, or just safer to swap out the STL vector with an int*?
(Yes in my example zeroing the memory is pointless, but imagine it having like 15+ variables in addition to the vector that I wish to quickly initialize to Zero)