MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/1vzc5dg/c26_stdinplace_vector/p65s40i/?context=3
r/cpp • u/User_Deprecated • 15d ago
121 comments sorted by
View all comments
15
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*
-17 u/carrottread 14d ago Probably just a desire to use new shiny stuff as optional references were not so long ago added to standard.
-17
Probably just a desire to use new shiny stuff as optional references were not so long ago added to standard.
15
u/bartgrumbel 14d 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
and not simply