mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
Added suggestion to use a pointer member instead of a reference; closes #1783
This commit is contained in:
parent
03fc3a359b
commit
402815345e
|
@ -4593,6 +4593,12 @@ They are not useful, and make types difficult to use by making them either uncop
|
|||
// ...
|
||||
};
|
||||
|
||||
The `const` and `&` data members make this class "only-sort-of-copyable" -- copy-constructible but not copy-assignable.
|
||||
|
||||
##### Note
|
||||
|
||||
If you need a member to point to something, use a pointer (raw or smart, and `gsl::not_null` if it should not be null) instead of a reference.
|
||||
|
||||
##### Enforcement
|
||||
|
||||
Flag a data member that is `const`, `&`, or `&&`.
|
||||
|
|
Loading…
Reference in New Issue
Block a user