4 ms·
I cannot think why you would want to a shared pointer argument instead of a reference. A better interface would be: void foo( const Widget& widget ); Calle
by Gupie 7y ago
I cannot think why you would want to a shared pointer argument instead of a reference. A better interface would be:
void foo( const Widget& widget );
Called by
foo( *widget_ptr );
or
foo( widget );
No doubt there are special circumstance by normally foo would not care, should not care, whether the Widget is on the stack or heap, controlled by a dump or smart pointer.
- deleted 7y ago[deleted]
- wffurr 7y agoThat's not const-equivalent to the example. The Widget itself is mutable.