In a vector of structs, should I be using char[] instead of std::string in
structures so that they are POD?
I have several large (100,000 up to 10,000,000) vector of objects. Should
I stick with structures like:
typedef struct {
char name[64];
int number;
long offset;
}
instead of:
typedef struct {
std::string name;
int number;
long offset;
}
I want to reuse the vector which contains this large number of objects,
but I'm worried that when I call clear(), if I use the struct with
std::string, I'll end up with 1,000,000 destructor calls.
Is this a common issue with using std::string versus char[]?
No comments:
Post a Comment