as you could see in the title, I am working on a vector of structs.
one of the struct members is string word. when i am trying to enter data to this member in this way: (*iv).word=temp_str;, i get a runtime error.
while (is!=str1.end())
{
if (((*is)!='-')&&((*is)!='.')&&((*is)!=',')&&((*is)!=';')&&((*is)!='?')&&((*is)!='!')&&((*is)!=':'))
{
temp_str.push_back(*is);
++is;
}
else
{
(*iv).word=temp_str;
++iv;
str1.erase(is);
temp_str.clear();
}
}
this may be the relevant code interval.
should say- word and temp_str are of string type. iv is an iterator to the vector.
what is the right way to enter data into a struct member in this case?