mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-16 20:37:03 +03:00
Remove guidance against passing unique_ptr<T> by const&, closes #2240
This commit is contained in:
@@ -9993,14 +9993,9 @@ Using `unique_ptr` in this way both documents and enforces the function call's o
|
||||
|
||||
void uses(widget*); // just uses the widget
|
||||
|
||||
##### Example, bad
|
||||
|
||||
void thinko(const unique_ptr<widget>&); // usually not what you want
|
||||
|
||||
##### Enforcement
|
||||
|
||||
* (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.
|
||||
* (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.
|
||||
|
||||
### <a name="Rr-reseat"></a>R.33: Take a `unique_ptr<widget>&` parameter to express that a function reseats the `widget`
|
||||
|
||||
@@ -10016,14 +10011,9 @@ Using `unique_ptr` in this way both documents and enforces the function call's r
|
||||
|
||||
void reseat(unique_ptr<widget>&); // "will" or "might" reseat pointer
|
||||
|
||||
##### Example, bad
|
||||
|
||||
void thinko(const unique_ptr<widget>&); // usually not what you want
|
||||
|
||||
##### Enforcement
|
||||
|
||||
* (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.
|
||||
* (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.
|
||||
|
||||
### <a name="Rr-sharedptrparam-owner"></a>R.34: Take a `shared_ptr<widget>` parameter to express shared ownership
|
||||
|
||||
|
||||
Reference in New Issue
Block a user