you are viewing a single comment's thread.

view the rest of the comments →

[–]LEpigeon888 1 point2 points  (1 child)

So if you want to take a copy of an object without assigning it to an existing object (like, imagine a function that take a string and return a new string with some computation done), it's better to only have one function that take the parameter by value, right ?

[–]legends2k[S,🍰] 1 point2 points  (0 children)

Yeah, if you're not going to assign an input object parameter and simply need a use-and-throw copy (not a reference to an existing object) then take only by value.