News for hackers. Stuff that matters.
Re:Care is needed to use C++ std:optional with non-trivial o... by exitb on Friday January 13, 2023 @09:27AM (#34368164)
::value() method can both return a reference (bare use) and give up the ownership of the wrapped value (used with std::move). You just have to state your intention correctly. It's not a problem with std::optional specifically, it's just the default C++ behavior. The entire thing works much better in Rust, where move is the default op and copies need to be explicit.

There are no comments on this comment yet.