lundi 8 juillet 2019

Type deduction for template references

Let's consider the following code:

template<typename T>
void f(T&);

int x=0;
int y=1;
f(x+y);

It seems that type deduction happens for this code. But why? There is no reference collapsing rule that will produce int&& at the end.

Aucun commentaire:

Enregistrer un commentaire