Passing by reference avoids making an unnecessary copy, passing by const reference also means you will not alter the data passed into the function. Return type has nothing to do with it.