vector<S> v;
S s1("Jon");
S s2("Mike");
S s3("Kim");
S s4("Steve");
S s5("Kevin");
v.push_back(s1);
v.push_back(s2);
v.push_back(s3);
v.push_back(s4);
v.push_back(s5);
My program will create 5 objects every time, whats the most efficient way to do the above? I'm sure how I'm doing it is not.
I need to be able to call the object from the vector.