r/cpp • • Aug 26 '26

C++26: std::inplace_vector

https://www.sandordargo.com/blog/2026/08/26/cpp26-inplace-vector
185 Upvotes

121 comments sorted by

View all comments

Show parent comment

3

u/jwakely libstdc++ tamer, LWG chair Aug 29 '26

When you chain multiple calls like that it's less clear because of the use of nesting instead of chaining. But mostly because a pointer is still not a reference:

https://brevzin.github.io/c++/2021/12/13/optional-ref-ptr/

An optional ref is simply the more expressive type for these functions and fits the semantics better:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3981r2.html

2

u/_Noreturn Sep 04 '26

This nesting issue should really be solved with a language feature...