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

4

u/wyrn Aug 16 '26

The class used to have value-semantics.

Like I said before, that's not what value semantics means.

For example, I could ask for t.size() at all times, because t was a value and would still be there after a move.

... and the result you'd get after a move would be meaningless and you'd be able to do nothing with it.

because indirect has an additional pointer-like semantic:

No, it is not pointer-like semantics. It is value semantics. What you're complaining about is that you can't use it after a move. But you can't use anything after a move. That has nothing to do with pointers.

It would be much better if it had value semantics.

It does. You're just confused about how values in general behave.

Like I said. Watch Sean's explanation.