From 06fabdc9af386c75ae308a004fde75b0e09f5cfd Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Thu, 19 Jan 2023 14:42:25 -0800 Subject: [PATCH] Update C.12 to apply to copyable/movable types, closes #2012 --- CppCoreGuidelines.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index b7d975c..26e44ba 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -4748,11 +4748,11 @@ so they can't be regular; instead, they tend to be move-only. ??? -### C.12: Don't make data members `const` or references +### C.12: Don't make data members `const` or references in a copyable or movable type ##### Reason -They are not useful, and make types difficult to use by making them either uncopyable or partially uncopyable for subtle reasons. +`const` and reference data members are not useful in a copyable or movable type, and make such types difficult to use by making them at least partly uncopyable/unmovable for subtle reasons. ##### Example; bad @@ -4770,7 +4770,7 @@ If you need a member to point to something, use a pointer (raw or smart, and `gs ##### Enforcement -Flag a data member that is `const`, `&`, or `&&`. +Flag a data member that is `const`, `&`, or `&&` in a type that has any copy or move operation.