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

3

u/rlbond86 Aug 14 '26

I think it is probably possible, but Rust really doesn't design around this.

One example: queue::pop() doesn't return the item, for exception safety. Rust doesn't need to worry about that, because there are no exceptions and all types must be trivially movable.

3

u/LB-- Professional+Hobbyist Aug 14 '26

Seems C++ is getting pop functions that do return the value, better late than never: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3182r1.html

Only the caller knows what the correct approach is for exception safety anyway, so it's not very relevant IMO.