Suppose I have a class called Student with the following value constructor:
Student::Student(const string &id) : id_(id){}
And in the main.cpp I have:
shared_ptr<Student> s1(new Student("st1"));
shared_ptr<Student> s2(new Student("st2"));
shared_ptr<Student> s3(new Student("st3"));
vector<Student> vect;
vect.push_back(s1);
vect.push_back(s2);
vect.push_back(s3);
Then I intend to retreive a student with id "st2" from vect
and assign it to a variable, how do I do that?