From 46f38a7917d69d6a9edccfdc48bb23866e2c7f3a Mon Sep 17 00:00:00 2001 From: hsutter Date: Fri, 1 Jan 2016 10:48:34 -0800 Subject: [PATCH] Closed #388. --- CppCoreGuidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index aa593d4..2e9766c 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -1795,7 +1795,7 @@ Function definition rules: * [F.4: If a function may have to be evaluated at compile time, declare it `constexpr`](#Rf-constexpr) * [F.5: If a function is very small and time critical, declare it inline](#Rf-inline) * [F.6: If your function may not throw, declare it `noexcept`](#Rf-noexcept) -* [F.7: For general use, take `T*` arguments rather than smart pointers](#Rf-smart) +* [F.7: For general use, take `T*` or `T&` arguments rather than smart pointers](#Rf-smart) * [F.8: Prefer pure functions](#Rf-pure) Parameter passing expression rules: @@ -2184,11 +2184,11 @@ Destructors, `swap` functions, move operations, and default constructors should * Flag functions that are not `noexcept`, yet cannot throw. * Flag throwing `swap`, `move`, destructors, and default constructors. -### F.7: For general use, take `T*` arguments rather than smart pointers +### F.7: For general use, take `T*` or `T&` arguments rather than smart pointers ##### Reason -Passing a smart pointer transfers or shares ownership. +Passing a smart pointer transfers or shares ownership and should only be used when ownership semantics are intended (see [R.30](#Rr-smartptrparam)). Passing by smart pointer restricts the use of a function to callers that use smart pointers. Passing a shared smart pointer (e.g., `std::shared_ptr`) implies a run-time cost.