Boost logo

Boost :

Subject: Re: [boost] [type_erasure]any(U,static_binding) stores wrong type
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-07-29 21:21:00


On 07/29/12 12:07, Larry Evans wrote:
> On 07/29/12 10:06, Larry Evans wrote:
>> On 07/29/12 09:48, Larry Evans wrote:
>>> On 07/29/12 08:06, Larry Evans wrote:
[snip]
> with the any diffs shown in 1st attachment,
> the output of 2nd attachment is:
>
> ./static_binding.exe
> std::is_copy_constructible<ph_erasee_type>=0
> 55:ph_ctor_arg<boost::type_erasure::_a>::CTOR.default:my_instance=0
> creating a_fst from a_ctor_arg
> 101:ph_erasee<boost::type_erasure::_a>::CTOR.(const
> ph_ctor_arg<boost::type_erasure::_a>&):my_instance=0:(void*)this=0x19f4b50
> :*fst_cast=ph_erasee<boost::type_erasure::_a>.my_instance=0:(void*)fst_cast=0x19f4b50
> typeid(*fst_cast).name()=ph_erasee<boost::type_erasure::_a>
>
> Showing that the expected type, i.e. ph_erasee<_a>, is created.
> The any change makes sure to create the expected type,
> mpl::at<Map,T>::type with help of new template function:
>
> make_storage<Constructee, U&...>
>
> which constructs, a Constructee.
>
[snip]
Moving this make_storage to within the any definition allows
slightly less boilerplate coding, resulting in a diff with
the svn any.hpp shown in attached.

HTH.

-regards,
Larry




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