EDIT: It seems this is a problem with using memset
on my struct, instead clearing the vector. Thanks to all that have provided advice!
I'm attempting to clear my vector of Subject objects (my own defined class) called people. The vector sits in a struct (pQA) and is defined as the following:
typedef struct _FSTRUCT_
{
const char * filePath;
std::vector<Subject> people;
long srcImageWidth;
long srcImageHeight;
STRUCT_CONFIG_PARAMS * configParam;
unsigned char * imageBuf;
int imageBufLen;
} STRUCT_FSTRUCT;
I am creating the pQA struct by:
STRUCT_FSTRUCT *pQA = NULL;
pQA = new STRUCT_FSTRUCT();
memset(pQA,0,sizeof(STRUCT_FSTRUCT));
I populate 'people' with data by using the Subject class' set methods. This is all fine. What I am wanting to do is then reset 'people', i.e. clear out all data and set the size to 0. I call the below method:
int ResetFaceCollection()
{
if (!pQA->people.empty())
{
pQA->people.clear();
}
}
The clear()
line throws a debug assertion failed error message which states "Expression: vector iterators incompatible".
I'm not sure if this has anything to do with Subject's destructor:
Subject::~Subject(void)
{
}
I'm not using any pointers, so from what I've gathered, the destructor looks OK. I have, of course, defined the destructor in my .h file also ~Subject(void);
.
I'm a bit lost as to why this is happening. Can anyone provide some insight?
I apologize if I'm omitted any necessary code, can update upon request!