mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
Update CppCoreGuidelines.md
This commit is contained in:
@@ -16251,11 +16251,11 @@ and should be used only as building blocks for meaningful concepts, rather than
|
|||||||
|
|
||||||
int x = 7;
|
int x = 7;
|
||||||
int y = 9;
|
int y = 9;
|
||||||
auto z = plus(x, y); // z = 16
|
auto z = algo(x, y); // z = 16
|
||||||
|
|
||||||
string xx = "7";
|
string xx = "7";
|
||||||
string yy = "9";
|
string yy = "9";
|
||||||
auto zz = plus(xx, yy); // zz = "79"
|
auto zz = algo(xx, yy); // zz = "79"
|
||||||
|
|
||||||
Maybe the concatenation was expected. More likely, it was an accident. Defining minus equivalently would give dramatically different sets of accepted types.
|
Maybe the concatenation was expected. More likely, it was an accident. Defining minus equivalently would give dramatically different sets of accepted types.
|
||||||
This `Addable` violates the mathematical rule that addition is supposed to be commutative: `a+b == b+a`.
|
This `Addable` violates the mathematical rule that addition is supposed to be commutative: `a+b == b+a`.
|
||||||
|
|||||||
Reference in New Issue
Block a user