You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CppCoreGuidelines.md
-10Lines changed: 0 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -9993,14 +9993,9 @@ Using `unique_ptr` in this way both documents and enforces the function call's o
9993
9993
9994
9994
void uses(widget*); // just uses the widget
9995
9995
9996
-
##### Example, bad
9997
-
9998
-
void thinko(const unique_ptr<widget>&); // usually not what you want
9999
-
10000
9996
##### Enforcement
10001
9997
10002
9998
* (Simple) Warn if a function takes a `Unique_pointer<T>` parameter by lvalue reference and does not either assign to it or call `reset()` on it on at least one code path. Suggest taking a `T*` or `T&` instead.
10003
-
* (Simple) ((Foundation)) Warn if a function takes a `Unique_pointer<T>` parameter by reference to `const`. Suggest taking a `const T*` or `const T&` instead.
10004
9999
10005
10000
### <a name="Rr-reseat"></a>R.33: Take a `unique_ptr<widget>&` parameter to express that a function reseats the `widget`
10006
10001
@@ -10016,14 +10011,9 @@ Using `unique_ptr` in this way both documents and enforces the function call's r
10016
10011
10017
10012
void reseat(unique_ptr<widget>&); // "will" or "might" reseat pointer
10018
10013
10019
-
##### Example, bad
10020
-
10021
-
void thinko(const unique_ptr<widget>&); // usually not what you want
10022
-
10023
10014
##### Enforcement
10024
10015
10025
10016
* (Simple) Warn if a function takes a `Unique_pointer<T>` parameter by lvalue reference and does not either assign to it or call `reset()` on it on at least one code path. Suggest taking a `T*` or `T&` instead.
10026
-
* (Simple) ((Foundation)) Warn if a function takes a `Unique_pointer<T>` parameter by reference to `const`. Suggest taking a `const T*` or `const T&` instead.
10027
10017
10028
10018
### <a name="Rr-sharedptrparam-owner"></a>R.34: Take a `shared_ptr<widget>` parameter to express shared ownership
0 commit comments