diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index e9a39cd..cdc1c21 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -5297,17 +5297,17 @@ Note that because of language rules, the covariant return type cannot be a smart public: point(int xx, int yy) : x{xx}, y{yy} { } int get_x() { return x; } - void set_x(int xx) { x = xx; } + void set_x(int xx) { x = xx; } int get_y() { return y; } - void set_y(int yy) { y = yy; } - // no behavioral member functions + void set_y(int yy) { y = yy; } + // no behavioral member functions }; Consider making such a class a `struct` -- that is, a behaviorless bunch of variables, all public data and no member functions. struct point { - int x = 0; - int y = 0; + int x = 0; + int y = 0; }; ##### Note @@ -8695,12 +8695,12 @@ make the job of the optimizer much harder. Simple code often optimizes better th ##### Example int matrix[rows][cols]; - + //bad for(int c=0; c p = D::Create(); // creating a D object + shared_ptr p = D::Create(); // creating a D object This design requires the following discipline: @@ -13246,7 +13246,7 @@ Most compilers already warn about simple cases and has the information to do mor { return ...; } - + auto v = get_large_vector(); //return by value is ok, most modern compilers will do copy elision ##### Example