
Niels Dekker - mail address until 2008-12-31 wrote:
Fernando Cacciola wrote:
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.
Please explain! Doesn't a call to boost::in_place(), having zero arguments, require T to be DefaultConstructible?
I was posposing to remove that requirement to have it be zero-initialized instead... but don't listen to me. Is there a list with the worst ideas ever? I'd like to add this one ;) Now that I finally got that much needed jar of cofee: I do like Thorsten proposal even if the implementation must use type-traits to do that only when the type is default-constructible. Best Fernando Cacciola