I would like to update a smart pointer from a reference.
shared_ptr<My_Toy> my_toy_ptr;
// Something...
void update(shared_ptr<My_Toy> my_toy_ptr, My_Toy& toy){
my_toy_ptr = &toy;
}
...but his code generates an error.
How can I do this operation?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…