The lifetime rules in C++ let a compiler make assumptions about the relationship between addresses and instances. Reinitializing an object with constant members (e.g. via placement new) does not interact well with those rules. std::launder is a hint to the compiler that an address can only refer to a new object and not to any object that previously existed at the same address, independent of the lifetime rules.At least, that's what I'm gathering after a few minutes of glancing through the above links. N4430 is a little dense to read. :)
On Friday, May 20, 2016 at 6:28:50 PM UTC-7, jgot...@gmail.com wrote:A few posts here have mentioned a function called std::launder. I know it has something to do with pointer lifetime, but I don't really understand what. Could someone tell me in simple terms what it does and when I might need to call it?
Thank you,
Joe Gottman
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussio...@isocpp.org.
To post to this group, send email to std-dis...@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-discussion/.