For the following piece of code:
template <class T>
void foo(T && t)
{ }
struct Test {};
int main()
{
Test test;
foo(test);
return 0;
}
output of an instantiation of foo is the following:
/* First instantiated from: insights.cpp:10 */
#ifdef INSIGHTS_USE_TEMPLATE
template<>
void foo<Test &>(Test && t)
{
}
#endif
Argument type should be Test & but not Test && because of reference collapsing.
For the following piece of code:
output of an instantiation of
foois the following:Argument type should be
Test &but notTest &&because of reference collapsing.