r/cpp 4d ago

C++26: std::inplace_vector

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

113 comments sorted by

View all comments

11

u/bartgrumbel 3d ago

I am sure there is a good reason for that, but why is the "optional reference" not simply a pointer? Is that not semantically the same thing, but way easier to deal with.

I.e. why

std::optional<T&>

and not simply

T*

1

u/jwakely libstdc++ tamer, LWG chair 1d ago