a***@googlemail.com
2015-07-06 14:13:51 UTC
Hello,
the implementation of something like boost variant, to switch types, will
call the destructor of one type, and then call in-place new of the other
type with the same memory. What is in the standard or how does variant have
to be implemented to avoid violation of the strict aliasing rule? Or in
other words, how does the compiler know not to reorder the in-place new
before the destructor call because the two cannot possibly alias?
Thanks for enlightenment!
Arno
the implementation of something like boost variant, to switch types, will
call the destructor of one type, and then call in-place new of the other
type with the same memory. What is in the standard or how does variant have
to be implemented to avoid violation of the strict aliasing rule? Or in
other words, how does the compiler know not to reorder the in-place new
before the destructor call because the two cannot possibly alias?
Thanks for enlightenment!
Arno
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]