I have a structure
struct Rulestrc
{
char* rulen;
vector<char*>v6 ;
char* resp;
};
I then create an array of structures - Rulestrc tp[100]. However the content of tp is constantly changing during the run of my program, therefore I need to clear the contents of vector. I do this:
for (y=0; y<100; y++)
{
if (tp[y].v6.size()) // because some of the vectors may have no content
{
tp[y].v6.clear();
}
I have also tried:
for(vector<char *>::size_type ee=0; ee<tp[ee].v6.size(); ee++)
{
tp[ee].v6.clear()
}
However, when I do run my program I find that the vector is not entirely clear. ie. some of the previous content remains.
Can you offer any advice please?
struct Rulestrc
{
char* rulen;
vector<char*>v6 ;
char* resp;
};
I then create an array of structures - Rulestrc tp[100]. However the content of tp is constantly changing during the run of my program, therefore I need to clear the contents of vector. I do this:
for (y=0; y<100; y++)
{
if (tp[y].v6.size()) // because some of the vectors may have no content
{
tp[y].v6.clear();
}
I have also tried:
for(vector<char *>::size_type ee=0; ee<tp[ee].v6.size(); ee++)
{
tp[ee].v6.clear()
}
However, when I do run my program I find that the vector is not entirely clear. ie. some of the previous content remains.
Can you offer any advice please?
Comment