Skip to content

Commit bddbab3

Browse files
authored
Merge pull request cpp-best-practices#63 from arunksaha/formatting
formatting fix
2 parents 6e3f2d3 + eea3d25 commit bddbab3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

03-Style.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ They should be preferred to macros, because macros do not honor namespaces, etc.
332332

333333
## Use Operator Overloads Judiciously
334334

335-
Operator overloading was invented to enable expressive syntax. Expressive in the sense that adding two big integers looks like `a + b` and not `a.add(b)`. Another common example is std::string, where it is very common to concatenate two strings with `string1 + string2`.
335+
Operator overloading was invented to enable expressive syntax. Expressive in the sense that adding two big integers looks like `a + b` and not `a.add(b)`. Another common example is `std::string`, where it is very common to concatenate two strings with `string1 + string2`.
336336

337337
However, you can easily create unreadable expressions using too much or wrong operator overloading. When overloading operators, there are three basic rules to follow as described [on stackoverflow](http://stackoverflow.com/questions/4421706/operator-overloading/4421708#4421708).
338338

08-Considering_Performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ if (caseA) {
179179

180180
```cpp
181181
// Better Idea
182-
const std::string somevalue = caseA?"Value A":"Value B";
182+
const std::string somevalue = caseA ? "Value A" : "Value B";
183183
```
184184

185185
More complex cases can be facilitated with an [immediately-invoked lambda](http://blog2.emptycrate.com/content/complex-object-initialization-optimization-iife-c11).

0 commit comments

Comments
 (0)