Hi, I've a simple class MailBox, in the .h file I've declared a vector vector<Message> _emails;. The class includes a method print() which seeks to iterate over each element in the vector, however I'm gettin d following error when i run my main() MailBox.cpp:25: instantiated from here which obviously means that im trying, however I dont know how or where to instantiate the Vector so I can iterate over it, and hope someone could show me how to do it in code... ta...
You do know that Message current = _emails.at(i) copies the object which, judging by the name, probably implies costly string copies. You could also do this: _emails[i].print()
MailBox.cpp:25: instantiated from here
This is just additional information about an error, not an error itself. It gives context to some error message above this line. Read a little more carefully and you'll see what the error is really about. Probably something related to _emails.
Instantiating an object just means creating it. A necessary step in order to do anything with it.
EDIT: std::vector::size() tells you the size of the vector.