mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 04:44:34 +03:00
Added suggestion to use a pointer member instead of a reference; closes #1783
This commit is contained in:
@@ -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
|
##### Enforcement
|
||||||
|
|
||||||
Flag a data member that is `const`, `&`, or `&&`.
|
Flag a data member that is `const`, `&`, or `&&`.
|
||||||
|
|||||||
Reference in New Issue
Block a user