Subject: Re: [boost] [type_erasure] Downcasting is now possible
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2015-03-10 12:38:27
On 03/10/2015 07:33 AM, Mathias Gaunard wrote:
> On 08/03/2015 05:27, Steven Watanabe wrote:
>> The calls to register_binding are necessary for
>> this to work, unfortunately. I don't think it's
>> possible to implement dynamic_any_cast without
>> some kind of registration, but at least it only
>> needs to be called once for each concept/type
>> combination. If anyone has any better ideas
>> about how to handle this, I'd love to hear it.
> If you're doing this, you might as well implement full dynamic duck typing.
> If the expression is valid, you call it, otherwise you raise an exception.
Oh, I agree. However, the cost of such a call
is significantly greater then a normal virtual
call. Thus, I don't want the library to do
this without being told explicitly that it's the
desired behavior. With what I have already, the
implementation of such a feature is trivial. The
real issue is defining the interface for it.