mercredi 27 juillet 2016

Why lvalues can be bound to rvalue ref but it cant be done directly? [duplicate]

I was trying to play with rvalue references and suddenly I discovered something like rvalue reference of lvalue reference ( int& &&) exists but developer cant just write them directly in source.

Explain the error and solution for following code :

int main()
{
    int i=5;
    auto &&irr=i;

    using T=int&;
    T &&irr2=i;

    int& &&irr3=i;  // produces error
    return 0;
}

Thanks in advance...

Aucun commentaire:

Enregistrer un commentaire