
Frank Mori Hess wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Friday 11 April 2008 15:00 pm, Fernando Cacciola wrote:
Hi Thorsten,
Adding the new requirement is out of the question, but it's definitely possible to choose default construction or zero-initialization as appropiate. And IMO that magic would be best placed within boost::in_place() itself since it makes a lot of sense, given its nature, to do zero-initialization for non-default constructible types.
With such a smart in_place factory, the optional swap implementation would look exactly as you proposed it AFAICT.
If I'm following, you're proposing calling swap on an object which doesn't really exist, but is just a zero'ed block of memory? Wouldn't that be undefined behavior?
Yeap, it would... I'm writting nonsense already and the weekend haven't even started yet :) Best Fernando