lordgamez commented on pull request #900: URL: https://github.com/apache/nifi-minifi-cpp/pull/900#issuecomment-690927794
> There are a bunch of changes changing "pass shared_ptr by value" to "pass shared_ptr by const ref". Why? > If we intend to share ownership, it should be passed by value. If we just want to use the underlying object, passing a reference or raw pointer to that is probably better. > > Related very incomplete guideline: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rr-sharedptrparam-const In this case I suppose we only want to use the underlying object so we do not need to pass by value and we can use a raw pointer or a simple reference here. The only difference maybe is that if we decide later that we need to share the ownership with someone in the call chain we have the possibility. As I recall clang static analyzer usually suggests using shared_ptr const refs in these cases. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
