19 Mar
2009
19 Mar
'09
4:17 p.m.
AMDG anony wrote:
Is there some utility in passing shared_ptr's as references as here:
void bla(boost::shared_ptr<T>& bla_ptr);
This avoids creating of a new object and copying overhead, but is it safe? When would you recommend it and when not?
Why wouldn't it be safe? Unless the function stores a pointer or reference to the shared_ptr after it returns, there is no danger. In Christ, Steven Watanabe