When I consider the two following overloads:
template void f(const T&... x);
template void f(const T& x);
There is not a universal priority between these two functions. They compete equally in the overload resolution algorithm. In general the so-called "universal reference" wins unless const T&
is an exact match, and there the const T&
wins.
struct A {};
int
main()
{
f(std::declval()); // calls f(A&&), #1
f(std::declval()); // calls f(const A&&), #1
f(std::declval()); // calls f(A&), #1
f(std::declval()); // calls f(A&&), #1
f(std::declval()); // calls f(const A&&), #1
f(std::declval()); // calls f(const A&), #2
}
Good advice is to never overload like this.