
On 06/15/2012 09:21 PM, Steven Watanabe wrote:
AMDG
On 06/13/2012 01:46 PM, Karsten Ahnert wrote:
On 05/22/2012 10:34 PM, Steven Watanabe wrote:
I'd like to request a formal review of the TypeErasure library that I've posted about several times before here.
I am not sure if this has already been a topic here, but I wonder if the any type can be default constructible? The docs state that this is possible via type_erase::constructible< _self() >, but it is not working, at least for me.
What do you want the default constructor to do? constructible<_self()> captures the default constructor of the stored type. However, it doesn't map to a default constructor of any<> because there would be no way to know what the contained type is.
typedef mpl::vector<..., constructible<_self()> > Concept; T value; any<Concept> x(value); any<Concept> y(binding_of(x));
y contains a default constructed instance of T.
Ok, I see. I misunderstood the docs: "Now, suppose that we want a default constructor?" refers to the default construction of T.
Now, as far as having a default constructor that sets the any to a null state goes, I intended to implement it, but forgot about it. I should have it in before the review, though.
Exactly, I missed the default constructor of any, initializing any to a null state.