You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CppCoreGuidelines.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -2329,7 +2329,7 @@ In fact, C++98's standard library already used this convenient feature, because
2329
2329
For example, given a `set<string> myset`, consider:
2330
2330
2331
2331
// C++98
2332
-
result = myset.insert( “Hello” );
2332
+
result = myset.insert( “Hello” );
2333
2333
if (result.second) do_something_with( result.first ); // workaround
2334
2334
2335
2335
With C++11 we can write this, putting the results directly in existing local variables:
@@ -2338,7 +2338,7 @@ With C++11 we can write this, putting the results directly in existing local var
2338
2338
Someothertype success; // used these variables for some other purpose
2339
2339
2340
2340
tie( iter, success ) = myset.insert( “Hello” ); // normal return value
2341
-
if (success) do_something_with( iter );
2341
+
if (success) do_something_with( iter );
2342
2342
2343
2343
**Exception**: For types like `string` and `vector` that carry additional capacity, it can sometimes be useful to treat it as in/out instead by using the "caller-allocated out" pattern, which is to pass an output-only object by reference to non-`const` so that when the callee writes to it the object can reuse any capacity or other resources that it already contains. This technique can dramatically reduce the number of allocations in a loop that repeatedly calls other functions to get string values, by using a single string object for the entire loop.
2344
2344
@@ -2599,7 +2599,7 @@ For passthrough functions that pass in parameters (by ordinary reference or by p
0 commit comments