Hi people,
here the following code I would like to run:
----------------------------------------------
Why the assigment does not work? How to assign a vector to a vector inside the struct?
Thanks for replies..
here the following code I would like to run:
----------------------------------------------
struct students
{
std::string name;
std::vector<std::string>> friends;
}
int main
{
std::vectors<std::string> friendsdatabase; //this vector contains data imported from a csv file, 3 elements
// "John","Lucy", "bert"
struct student1;
student1.name="Anna"
//I would like to assign the elements of the vector friendsdatabase to the vector student1.friends in this way
for (size_t m=0; m < friendsdatabase.size(); m++)
{
student1.friends.push_back(friendsdatabase[m]);
}
// Here I get the the error "unable to resolve the identifier push_back
return 0;
}
Why the assigment does not work? How to assign a vector to a vector inside the struct?
Thanks for replies..