In the code below, is_rvalue_reference returns true. I would expect testRef(int &&) to be called and not testRef(int &), but that's not the case (at least with my Visual Studio 2015 compiler).
Any idea of the reason why ?
void testRef( int&& i )
{
cout << "called testRef(int&&) " << endl;
}
void testRef( int& i )
{
cout << "called testRef(int&) " << endl;
}
int main()
{
int && rvalref = 4;
cout << "is rval? : " << std::is_rvalue_reference<decltype( rvalref )>() << endl;
testRef( rvalref );
}
Aucun commentaire:
Enregistrer un commentaire