samedi 18 avril 2015

What is the difference between these two function signatures?

I've been told here that the differences between these two signatures is not lvalue/rvalue.



template <typename RET_TYPE, typename...ARGs>
void takeFunction(RET_TYPE(& function)(ARGs...))
{
cout << "RValue function" << endl;
}

template <typename RET_TYPE, typename...ARGs>
void takeFunction(RET_TYPE(*& function)(ARGs...))
{
cout << "LValue function" << endl;
}

void function()
{
}

void testFn()
{
void(*f)() = function;
takeFunction(function);
takeFunction(f);
}


But if not that, then what is the difference that it is matching on?


Aucun commentaire:

Enregistrer un commentaire