r/cpp • • Aug 13 '26

C++26: std::indirect

https://www.sandordargo.com/blog/2026/08/12/cpp26-indirect
164 Upvotes

157 comments sorted by

View all comments

Show parent comment

7

u/ts826848 Aug 14 '26 edited Aug 14 '26

And non-destructive moves ultimately are the consequence of exceptions.

The move semantics proposal doesn't mention exceptions as a reason to go for non-destructive moves. The example given is that dealing with class hierarchies becomes ambiguous:

If you move the base first, then the source has a constructed derived part and a destructed base part. If you move the derived part first then the target has a constructed derived part and a not-yet-constructed base part. Neither option seems viable.

The proposal examplesexamines some possible solutions, but rejects those as "too much pain for not enough gain".

Edit: Fix typo

-2

u/rlbond86 Aug 14 '26

The proposal examples some possible solutions, but rejects those as "too much pain for not enough gain".

Wow amazing how completely wrong that was

4

u/ts826848 Aug 14 '26

Did you look at their proposed solutions? I'm not sure it's obvious those would be less wart-y over the long run, and I haven't seen anyone propose alternatives that would fare significantly better.

-2

u/rlbond86 Aug 14 '26

Their proposed solutions don't seem to have serious exploration

5

u/ts826848 Aug 14 '26

How much exploration would you have expected to see?