Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd948ee

Browse files
hctimcubbimew
authored andcommitted
Fix example code in F.20. (isocpp#1109)
1 parent 044a4b2 commit bd948ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CppCoreGuidelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,9 +2997,9 @@ Such older advice is now obsolete; it does not add value, and it interferes with
29972997
vector<int> g(const vector<int>& vx)
29982998
{
29992999
// ...
3000-
f() = vx; // prevented by the "const"
3000+
fct() = vx; // prevented by the "const"
30013001
// ...
3002-
return f(); // expensive copy: move semantics suppressed by the "const"
3002+
return fct(); // expensive copy: move semantics suppressed by the "const"
30033003
}
30043004

30053005
The argument for adding `const` to a return value is that it prevents (very rare) accidental access to a temporary.

0 commit comments

Comments
 (0)