Boost logo

Boost :

Subject: Re: [boost] [mixin] New library reminder
From: Borislav Stanimirov (b.stanimirov_at_[hidden])
Date: 2013-07-11 21:11:16


On 07/12/2013 03:13 AM, Larry Evans wrote:
> Hi Borislav.
>
> It looks interesting and fulfills a purpose somewhat like that
> of Steven's TypeErasure library:
>
> http://steven_watanabe.users.sourceforge.net/type_erasure/libs/type_erasure/doc/html/boost_typeerasure/basic.html
>
> Except it may be more dynamic. For example, the Mixin example here:
>
> http://ibob.github.io/boost.mixin/boost_mixin/introduction.html
>
> can add or remove methods at runtime; however, IIUC, the
> TypeErasure library cannot. I'd guess then that the
> TypeErasure method calls would be faster than those of
> the Mixin methods calls.
>
> Is that about right, Borislav or Steven, or am I missing something?
>
> -regards,
> Larry
>

I don't think there are many similarities there. The type erasure
library allows you to view existing types as a set of concepts.
Boost.Mixin allows you to compose types. That is the main difference.

And yes, Boost.Mixin allows you to change the object's composition (and
effectively interface) at runtime.

I'm guessing here, but I think the type erasure method calls are not
slower than virtual calls. Since it uses function pointers, I guess
they're about as fast as virtual. Boost.Mixin's method calls, however,
are slower than virtual calls. With compiler optimizations they reach
200-250% the speed of a regular virtual call and in terms of speed can
be compared to a boost/std::function call (although they're much faster
than std::function in "debug" mode).

The only similarity between the two libraries, that I see, is that both
allow you to have information hiding by having the interface be
physically separated from the implementation.

-- Borislav


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