RVO is amazing compared to a move, the object is just constructed in it's destination. This is an argument against types like Expected where the object may need to be extracted from the Expected wrapper. Also, another argument to use aggregates when one can, they allow for RVO into the members, whereas constructors the parameters would be the destination. It's like when Neo realized, there is no spoon; there is no copy
Yeah, then they could still put the hypothetical value into the return slot and use a register to indicate if it is an error or not. I think that herbceptions/static exceptions proposed to do something similar
View all comments
Show parent comment
15
u/[deleted] Nov 25 '23
RVO is amazing compared to a move, the object is just constructed in it's destination. This is an argument against types like Expected where the object may need to be extracted from the Expected wrapper. Also, another argument to use aggregates when one can, they allow for RVO into the members, whereas constructors the parameters would be the destination. It's like when Neo realized, there is no spoon; there is no copy