Boost logo

Boost :

Subject: Re: [boost] [type_erasure]any(const binding<Concept>&, ...) compile error
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-07-26 16:32:45


AMDG

On 07/26/2012 09:21 AM, Larry Evans wrote:
>
> However, in my defense, I couldn't see any reason why,
> if:
>
> any<Concept,_a> a_any
>
> can be created with static_map<Concept>, it couldn't be
> created with a binding<Concept>; thus, I guess I just
> glossed over the any.html#id2445089-bb doc.
>

The reason I didn't provide it, is that I
assumed that if the type you're constructing
is known statically, the entire set of type
bindings would be known statically.

> BTW what *is* the reason for the restriction on the Concept in the
> binding<Concept> CTOR. It's obviously not needed for creating
> an instance of AnyA with a value<_a>::type even when ConceptAB does
> not "contain a matching instance of constructible".
>

Yes it is. You're not understanding what
this constructor does properly.

template<class... T>
explicit any(binding<Concept>, T&& ...);

calls a type erased constructor.
The stored type is whatever the binding
says, /not/ T. constructible<...> is
required, because it is used to construct
the contained object.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk