3 ms·
Wait this is crazy. What's the legitimate use-case? Man I would hate to work on codebases that have these invariants violated.
by renewiltord 3y ago
Wait this is crazy. What's the legitimate use-case? Man I would hate to work on codebases that have these invariants violated.
- plorkyeran 3y agoThe original use case was that std::vector's API was specifically designed to make it possible to have a vector of a type with const members, but it turned out to be impossible to implement without hitting UB. std::launder was introduced as a way to make the obvious implementation correct. Since then the object lifetime rules were adjusted to make it unnecessary for that.
- renewiltord 3y agoOh interesting. Thank you.