Source

Thread

1/ @EricLengyel

I wrote down some thoughts about how a “transient” qualifier may have been a much better way to achieve move semantics in C++ compared to the awfulness of rvalue references.

http://ericlengyel.blogspot.com/2017/11/some-thoughts-about-rvalue-references.html

2/ @TimSweeneyEpic

@EricLengyel

Propagating transience to a member is unsound in general. You could access the same value twice and the second copy could be bogus due to someone having already moved it.

3/ @EricLengyel

@TimSweeneyEpic

I’d think that cases where the enclosing object wants to access a subobject that was already moved are less common and justify an explicit copy of the subobject as opposed to the current system where everything is explicitly moved.

4/ @TimSweeneyEpic

@EricLengyel

That’s a crazy default. You’d write what looks like fine code, and find that variables are corrupted when used more than once because the compiler defaults to moving them.

5/ @EricLengyel

@TimSweeneyEpic

It’s likely we’re not thinking in the same way. I don’t see a problem with this since transience can never be implicitly added. Moving would continue to occur only after you’re inside a context that has move semantics.

0 items under this folder.