mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-18 13:14:40 +03:00
Remove the other {{ that confuse Pages rendering
This commit is contained in:
@@ -7,7 +7,7 @@ Editors:
|
|||||||
* [Bjarne Stroustrup](http://www.stroustrup.com)
|
* [Bjarne Stroustrup](http://www.stroustrup.com)
|
||||||
* [Herb Sutter](http://herbsutter.com/)
|
* [Herb Sutter](http://herbsutter.com/)
|
||||||
|
|
||||||
This is a living document under continuous improvement.
|
This is a living document under continuous improvement.
|
||||||
Had it been an open-source (code) project, this would have been release 0.8.
|
Had it been an open-source (code) project, this would have been release 0.8.
|
||||||
Copying, use, modification, and creation of derivative works from this project is licensed under an MIT-style license.
|
Copying, use, modification, and creation of derivative works from this project is licensed under an MIT-style license.
|
||||||
Contributing to this project requires agreeing to a Contributor License. See the accompanying [LICENSE](LICENSE) file for details.
|
Contributing to this project requires agreeing to a Contributor License. See the accompanying [LICENSE](LICENSE) file for details.
|
||||||
@@ -8359,7 +8359,7 @@ Subscripting the resulting base pointer will lead to invalid object access and p
|
|||||||
|
|
||||||
void use(B*);
|
void use(B*);
|
||||||
|
|
||||||
D a[] = {{1, 2}, {3, 4}, {5, 6}};
|
D a[] = { {1, 2}, {3, 4}, {5, 6} };
|
||||||
B* p = a; // bad: a decays to &a[0] which is converted to a B*
|
B* p = a; // bad: a decays to &a[0] which is converted to a B*
|
||||||
p[1].x = 7; // overwrite a[0].y
|
p[1].x = 7; // overwrite a[0].y
|
||||||
|
|
||||||
@@ -12543,7 +12543,7 @@ In the rare cases where the slicing was deliberate the code can be surprising.
|
|||||||
class Shape { /* ... */ };
|
class Shape { /* ... */ };
|
||||||
class Circle : public Shape { /* ... */ Point c; int r; };
|
class Circle : public Shape { /* ... */ Point c; int r; };
|
||||||
|
|
||||||
Circle c {{0, 0}, 42};
|
Circle c { {0, 0}, 42 };
|
||||||
Shape s {c}; // copy construct only the Shape part of Circle
|
Shape s {c}; // copy construct only the Shape part of Circle
|
||||||
s = c; // or copy assign only the Shape part of Circle
|
s = c; // or copy assign only the Shape part of Circle
|
||||||
|
|
||||||
@@ -12551,7 +12551,7 @@ In the rare cases where the slicing was deliberate the code can be surprising.
|
|||||||
{
|
{
|
||||||
dest = src;
|
dest = src;
|
||||||
}
|
}
|
||||||
Circle c2 {{1, 1}, 43};
|
Circle c2 { {1, 1}, 43 };
|
||||||
assign(c, c2); // oops, not the whole state is transferred
|
assign(c, c2); // oops, not the whole state is transferred
|
||||||
assert(c == c2); // if we supply copying, we should also provide comparison,
|
assert(c == c2); // if we supply copying, we should also provide comparison,
|
||||||
// but this will likely return false
|
// but this will likely return false
|
||||||
@@ -15891,7 +15891,7 @@ To make error handling systematic, robust, and non-repetitive.
|
|||||||
|
|
||||||
void use()
|
void use()
|
||||||
{
|
{
|
||||||
Foo bar {{Thing{1}, Thing{2}, Thing{monkey}}, {"my_file", "r"}, "Here we go!"};
|
Foo bar { {Thing{1}, Thing{2}, Thing{monkey} }, {"my_file", "r"}, "Here we go!"};
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user