Check this answer for C++11. Basically, if you pass an lvalue the rvalue reference
From this article:
void f1(String s) {
vector<String> v;
v.push_back(std::move(s));
}
void f2(const String &s) {
vector<String> v;
v.push_back(s);
}
"For lvalue argument, ‘f1’ has one extra copy to pass the argument because it is by-value, while ‘f2’ has one extra copy to call push_back. So no difference; for rvalue argument, the compiler has to create a temporary ‘String(L“”)’ and pass the temporary to ‘f1’ or ‘f2’ anyway. Because ‘f2’ can take advantage of move ctor when the argument is a temporary (which is an rvalue), the costs to pass the argument are the same now for ‘f1’ and ‘f2’."
Continuing: " This means in C++11 we can get better performance by using pass-by-value approach when:
"
OTOH, for C++98 it is best to pass by reference - less data gets copied around. Passing const or non const depend of whether you need to change the argument or not.