Boost logo

Boost :

Subject: Re: [boost] RFC: type erasure
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-05-23 17:34:32

Steven Watanabe-4 wrote:
> Over the last few months I've re-done my
> type erasure library from scratch, fixing
> a lot of the bad design decisions I made
> originally. Here's a basic sample of what
> you can do with it:
> simulate boost::any:
> type_erasure::any<
> mpl::vector&lt;copy_constructible&lt;&gt;, typeid_<> > >
> x(10);
> simulate boost::function&lt;void(int)&gt;:
> type_erasure::any<
> mpl::vector&lt;copy_constructible&lt;&gt;, typeid_<>,
> callable&lt;void(int)&gt; > >
> f(foo);
> The code is available from the Vault:
> The library is nearly complete. I've included
> pre-built html documentation in the zip. Questions,
> comments, and criticism are welcome.


I've just taken a diagonal read at the documentation and the library seems
really promising.

I like how concepts are materialized using a template class that implements
the default behavior of the concept and that can be specialized to map type
to concepts. I understand that you need a second step to introduce the
functions themselves specializing concept_interface.

What I don't understand is the overloading issues. Could you use a concrete
example to try to clarify the problems you have addressed?

I would try to study more deeply your design in order to see the advantage
it could provide to my library. While developing Boost.Opaque (available on
the sandbox,
I was confronted to a similar problem, that is, how to add in a declarative
way, more operations to the underlying class. I have reached to manage with
this using what I have called a meta-mixin.

A MetaMixin is a meta-function having as nested type a Mixin. The archetype
of a MetaMixin is

struct MetaMixinArchetype {
    template (*typename Final, typename Base*)
    struct type : Base

Metamixins are is a similar way to your concepts, passing them in a

I will appreciate a lot if you can take a look and comment the design of


View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at