mercredi 31 mai 2017

What do they mean by having identity but not movable for Lvalue in C++ 11?

I am now studying C++ 11 and getting confused by value category of expressions in C++ 11. According to terminology the Lvalue is the top-left point of the W, that is iM (or i-m sometimes) meaning that "has identity but cannot be moved from". This really makes me confused. Please consider the example below:

#include <iostream>

int main()
{
    int a = 0, b = 1, c = 2;
    a = std::move(b = c);
    std::cout << a << '\n';
}

This example compiled well.

We all know that the assignment b = c is an Lvalue then what do they mean by 'cannot be moved from'? Please give examples that can clearly illustrate this!

Thanks!

Aucun commentaire:

Enregistrer un commentaire