lundi 22 juin 2015

C++ move semantics (and rvalue references) vs normal references

While reading some articles about the std::move semantics and the rvalue references, I came to know that they were introduced because copying data is an expensive job. True ! Copying is expensive but isn't that the same reason why we have "REFERENCES" in C++. They also just help pass the address of a variable and prevent the expensive procedure of copying.

Then why have std::move and rvalue been introduced ? I mean what job couldn't normal references do which the former ones could do ?

Aucun commentaire:

Enregistrer un commentaire