I know what boost::shared_ptr does… but boost::make_share came up what does that do.
Here is the code for boost::shared_ptr which shows my extend of knowledge…
#include<iostream>#include<boost/shared_ptr.hpp>classStudent{private:std::stringm_sName;std::stringm_sId;public:Student(std::stringsName,std::stringsId);~Student();std::stringgetName()const;std::stringgetId()const;};Student::Student(std::stringsName,std::stringsId):m_sName(sName),m_sId(sId){//Everything has been init}Student::~Student(){//Nothing to dostd::cout<<"Elvis has left the building."<<std::endl;}std::stringStudent::getName()const{returnm_sName;}std::stringStudent::getId()const{returnm_sId;}typedefboost::shared_ptr<Student>StudentPtr;intmain(){StudentPtrpStudent(newStudent("Leon Anavi","F010203"));std::cout<<"Student: "<<pStudent->getName()<<" "<<pStudent->getId()<<std::endl;return0;}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know what boost::shared_ptr does… but boost::make_share came up what does that do.
Here is the code for boost::shared_ptr which shows my extend of knowledge…