The call is correct. In the function process
, the parameter ptr
is a copy of the original shared pointer p
, which increases the reference count. Before the function scope ends, ptr
is destoryed and the reference count decreased back to the original value. Thus, after the function process
is executed, the reference count does not change.