The solution to the latest GotW problem is now available:
GotW #91 Solution: Smart Pointer Parameters (updated for C++11/14)
by Herb Sutter
From the article:
Guideline: Don’t pass a smart pointer as a function parameter unless you want to use or manipulate the smart pointer itself, such as to share or transfer ownership.
Guideline: Prefer passing objects by value,*
, or&
, not by smart pointer.If you’re saying, “hey, aren’t raw pointers evil?”, that’s excellent, because we’ll address that next...
Add a Comment
Comments are closed.