Boost logo

Boost :

Subject: Re: [boost] [TypeErasure] Forward constructors and binded types
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-07-19 10:55:14


AMDG

On 07/19/2012 07:36 AM, Larry Evans wrote:
>
>
> http://steven_watanabe.users.sourceforge.net/type_erasure/libs/type_erasure/example/construction.cpp
>
> was most helpful to me. The attached shows
> that 2 different bindings can be used to create
> 2 arguments to a construction of the 3ird placeholder,
> and it still works. I would have thought that
> the same bindings would have been required for the
> placeholders.

They are. This happens to work because
I cheated a little in the assertions,
but it's really undefined behavior.

> The attached produces output of:
>
> St5dequeIdSaIdEE
>
> suggesting the type constructed comes from the 1st
> placeholder. When the code is changed to:
>
> any<construct, _b> size(10, bindings1);
> any<construct, _c> val(2.5, bindings2);
>
> the output is:
>
> St6vectorIdSaIdEE
>
> supporting the above conclusion.
>
> Do the docs say anywhere that this is what
> happens when 2 different bindings are used
> to construct something?
>

http://steven_watanabe.users.sourceforge.net/type_erasure/libs/type_erasure/doc/html/boost/type_erasure/any.html#id2370327-bb

"The bindings of all the arguments that are any's, must be the same."

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