For the code below, I would like to know how to set std::shared_ptr to point the given objects in the two member functions. The Vector3 object whic
Disregarding the argument about whether using shared_ptr is a good idea or not, as explained by the accepted answer, you can use the following if you continue to use shared_ptr:
void addVtx (const Vector3& vt)
{
vtx.push_back(std::make_shared(vt));
}
void setVtx (size_t v, const Vector3& vt)
{
if ( vtx.size() > 0 && v < vtx.size() )
{
vtx[v] = std::make_shared(vt);
}
}