Gavin Lambert wrote:
Future uses "T get()". This is established standard. Smart pointers use "T* get()", which is equivalent to the above. Also standard. Boost Optional uses "T& get()" (although also provides value(), presumably for standard compatibility).
Std Optional uses "T value()". This is either still experimental or approved for C++17; I'm not entirely sure how far along that is.
It's in C++17.
The different interfaces of the above seem unfortunate (and Std Optional seems incorrect in this regard to me).
So why not "T get()"? That's much more consistent with other types.
.get() is when you only have one thing to get; it's for one-element
containers, where there's no ambiguity as to what is being got.
expected