Skip to content

Commit bbdf585

Browse files
committed
SL.io.50 (Avoid endl): Mention string streams
Explicitly mentioned string streams as `endl` insertions into string streams do actually occur in the wild.
1 parent ddef6cd commit bbdf585

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CppCoreGuidelines.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20308,6 +20308,11 @@ For writing to a file, there is rarely a need to `flush`.
2030820308

2030920309
##### Note
2031020310

20311+
For string streams (specifically `ostringstream`), the insertion of an `endl` is entirely equivalent
20312+
to the insertion of a `'\n'` character, but also in this case, `endl` might be slightly slower.
20313+
20314+
##### Note
20315+
2031120316
Apart from the (occasionally important) issue of performance,
2031220317
the choice between `'\n'` and `endl` is almost completely aesthetic.
2031320318

0 commit comments

Comments
 (0)