3 ms·
Sometimes I think rvalue-references were a bad idea. Sure they improve efficiency for people using objects directly instead of through a pointer, but the amount
by cjensen 2y ago
Sometimes I think rvalue-references were a bad idea. Sure they improve efficiency for people using objects directly instead of through a pointer, but the amount of mental model added worries me that the average coder will have no real clue what rvalue references are. People really overestimate how much most coders understand.
- 112233 2y agoAgree. Let's introduce xvalue, glvalue and prvalue to language spec. Let's define special cases for "auto". Then add some more ( decltype(auto) ). Let's add && overloading. Since it does not work automatically anyway, add move and forward. Now let's blame programmer for calling or not calling move or forward in specific place, because obviously when implementing algorithm the implicit lexical lifetimes of temporaries are what every programmer should focus his attention on.
- gpderetta 2y agoThey are quite complex and with a lot of ugly corners. I cannot but think that there must be a better solution. The problem is that smarter and better programmes than me couldn't find one that would fit cleanly in the existing language after almost a decade of trying (boost had library based move emulation at the turn of the millennium, and the same authors came up with universal refs).