Boost logo

Boost :

Subject: Re: [boost] [mixin] New library reminder
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-07-12 11:19:28


On 07/11/13 20:11, Borislav Stanimirov wrote:
> 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.
>
Ah! It's clearer now.

Now, suppose the "existing type" is the mixin object type, which
has been modified as shown in the introduction.html file:

using namespace boost::mixin;
object* o = new object; // just an empty object

// xml_serializer and book_data are some classes in the project
// there are external macros you need to call, to make them available as
// mixins
mutate(o)
    .add<xml_serializer>()
    .add<book_data>();

How could type TypeErasure library be used to attach concepts
analogous to xml_serializer and book_data to a mixin::object
which has been mutated as above? (BTW, I don't see a real use for
this; however, I'm just trying to get a better understanding of the
relationship between the two libraries).

TIA.

-regards,
Larry


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