I am currently using C++0x shared_ptr. I have a utility function which needs to take in a pointer to an object and the utility function only perform reading operation from the object and I could be sure that the object still exist when it need to dereference the pointer. I am wondering what is the best practice in passing the smart pointer down to a function like that? Should I pass the smart pointer by reference, by value, or could I get the raw pointer and pass it to the function? Also, which methods give the best performance?
Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With