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
All of this strings we can pass, by constant ref, like that const string& str.
The fact is that when passing by value, objects are copied, passing objects by reference, copying does not occur, therefore the program runs faster.
Also, look at pass by std::string_view, but in this case I am not an expert and not sure it can work for all four strings.
This may not only be about strings.
The text was updated successfully, but these errors were encountered:
I see many places in code, where objects pass by value, when could pass through ref(
&
).For example:
All of this strings we can pass, by constant ref, like that
const string& str
.The fact is that when passing by value, objects are copied, passing objects by reference, copying does not occur, therefore the program runs faster.
Also, look at pass by
std::string_view
, but in this case I am not an expert and not sure it can work for all four strings.This may not only be about strings.
The text was updated successfully, but these errors were encountered: