I have a vector of a class and need to use the push_back() function to add an unknown number of data to it. For each new instance of the class in the vector, I need to store 2 strings of data in it. I have a custom constructor in that class that takes 2 strings and stores them in the right variables in the class. I tried to use the following syntax to do this:
list.push_back(request, user);
where "list" is the name of the vector and "request" and "user" are the 2 strings the custom constructor needs, but this didn't seem to work, because the push_back() functions wants only 1 argument passed to it. How exactly would I go about doing this?
Sorry, my professor didn't spend a long time on vectors. Can you not make a vector of a class? Or is something else wrong? Looking on that page, it looks like to use push_back(), you have to give it the same data type as is stored in the vector. So i made a temporary instance of the class I'm using in the function, stored the data in there, then passed that temporary instance of the class to push_back(), but then I get some sort of error in ios_base.h
I found out the problem is my class had an iobookstream class inside it, which is an object my professor gave us to talk to his server. It apparently didn't like being copied, so I had to get rid of the one in the class and just start passing another one by reference. Thanks for the help, though.