Re: [webkit-dev] Moving from WTF::Optional to std::optional

2021-06-02 Thread Darin Adler via webkit-dev
Thanks for pointing that out, Chris. This advice goes beyond std::optional, by the way. For anything that we move from, there are two operations at are intended to be safe, from a C++ language and library design point of view: destroying the object and overwriting it by assigning a new value.

Re: [webkit-dev] Moving from WTF::Optional to std::optional

2021-06-01 Thread Chris Dumez via webkit-dev
Hi, Another thing Darin didn’t mention but I think people should be careful about: The move constructor for std::optional does not clear the is-set flag (while the one for WTF::Optional did). As a result, you will be having a very bad time if you do a use-after-move of a std::optional. Please