So I'm doing an assignment where I've created a data holder class called Directory. So in my other class I have a private member variable of a vector of Directory objects. I'm trying to add Directories to the vector but I keep getting this weird error."no matching function call..." Here's the weird part. When I have a function that returns a directory I can use that function to add to the vector. So I had in my code something like
Directory make_dir()
{
int size;
string name;
string path;
Directory d = Directory(name, size, path);
return d;
}
subdirs.push_back(make_dir())
This worked fine. Now I need the function to add multiple directories to I made a loop and made the function void like
void make_dir()
{
//some other code that opens a file and reads in directory info
while(du >> name)
{
du >> size >> name >> path;
subdirs.push_back( (Directory(name, size, path))
}
}
But for this I get a weird error. Anytime I try to push_back a directory through any other method that the first one I mentioned I get this darn "no matching function call error"