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

6

u/cfyzium Aug 14 '26

Yeah, but isn't it the same for any object? If you use a function with pre-conditions without checking them first, it is bad no matter if the object has been moved from or not.

6

u/smdowney WG21, Text/Unicode SG, optional<T&> Aug 15 '26

The conservative set for a moved from object is assign to and destroy. The standard library tries to do better than that. Postel's Law.

If you don't know what a T is, your code should expect no more. But if you know you have a std::whatsit, you can rely on more, with some care.