Skip to content

Commit de1861c

Browse files
committed
Remove guidance against passing unique_ptr<T> by const&, closes #2240
1 parent e738bcc commit de1861c

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

CppCoreGuidelines.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9993,14 +9993,9 @@ Using `unique_ptr` in this way both documents and enforces the function call's o
99939993

99949994
void uses(widget*); // just uses the widget
99959995

9996-
##### Example, bad
9997-
9998-
void thinko(const unique_ptr<widget>&); // usually not what you want
9999-
100009996
##### Enforcement
100019997

100029998
* (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.
100049999

1000510000
### <a name="Rr-reseat"></a>R.33: Take a `unique_ptr<widget>&` parameter to express that a function reseats the `widget`
1000610001

@@ -10016,14 +10011,9 @@ Using `unique_ptr` in this way both documents and enforces the function call's r
1001610011

1001710012
void reseat(unique_ptr<widget>&); // "will" or "might" reseat pointer
1001810013

10019-
##### Example, bad
10020-
10021-
void thinko(const unique_ptr<widget>&); // usually not what you want
10022-
1002310014
##### Enforcement
1002410015

1002510016
* (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.
1002710017

1002810018
### <a name="Rr-sharedptrparam-owner"></a>R.34: Take a `shared_ptr<widget>` parameter to express shared ownership
1002910019

0 commit comments

Comments
 (0)