3

When I mark the function as template it accepts l-values to bind with r-values.

void func(int&& param){}

template<typename T> void t_func(T&& param){}

int main(){
  int a = 10;
  func(a); // error
  t_func(a); // no error
}

Why is t_func accepting l-values to bind with r-value reference.

TheScore
  • 329
  • 3
  • 14

0 Answers0