At the moment, boost::optional<>
supports references but the std::experimental::optional<>
on my system from libstdc++ does not. Is this reflective of what might make it into the standard?
I know that the optional proposal author spun off optional references as a separate proposal so that the main optional proposal would have a better chance of being accepted. Was the proposal for optional references rejected or did work on it stop?
Is this reflective of what might make it into the standard?
From the working draft ([20.5.2/1]):
A program that necessitates the instantiation of template optional for a reference type [...] is ill-formed.
I guess this replies to your question.
Note that you can still work around it by using std::reference_wrapper
, as mentioned by @bobah in the comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With