
18 Feb
2022
18 Feb
'22
9:30 p.m.
Niall Douglas wrote:
Your examples aren't right - launder is for telling the compiler that an escaped value must be assumed to have changed, even if the compiler is allowed to assume it has not. I modified your example thusly: https://godbolt.org/z/oosdK6GMo
This example isn't right either, because `f` can easily `emplace` something into the passed `optional`. It needs to be https://godbolt.org/z/8qb79hK4E. Or, for completeness, https://godbolt.org/z/xxWToPo6M.