Re:Modern C++ Won't Save Us
by steveklabnik on Thursday April 25, 2019 @03:53PM
(#19751865)
Yes, you have to use if let, not let. That code would be a compiler error. (Specifically, a “non-exhaustive pattern” error.)
But people might not want to throw an exception, so
Must also be allowed. The consequence is someone can also just do No safety check is done and you get undefined behavior if the value is absent.I don't know rust so I suspect it has a language construct which c++ lacks that prevents you from doing