Generating a single functor from multiple ones

I would be quite interested in an utility that could generate a single functor with multiple overloads from multiple functors. It could be quite useful for example to visit a variant and all kinds of pattern matching. I tried to implement it, using this [1] as a basis. But then I wanted to add Lambda and ResultOf support, and thus I realized the reflection mechanism could really help to figure out what argument_type should be. Any ideas about how to implement that and make it work with ResultOf and Lambda? [1] http://groups.google.com/group/comp.std.c++/msg/34b98493a8531d58

Mathias Gaunard wrote:
I would be quite interested in an utility that could generate a single functor with multiple overloads from multiple functors.
It could be quite useful for example to visit a variant and all kinds of pattern matching.
I tried to implement it, using this [1] as a basis. But then I wanted to add Lambda and ResultOf support, and thus I realized the reflection mechanism could really help to figure out what argument_type should be.
Any ideas about how to implement that and make it work with ResultOf and Lambda?
Boost.Egg experimentally contains egg::overload. If interested, see: http://tinyurl.com/68luzd (It supports ResultOf and Lambda.) Regards, -- Shunsuke Sogame

On Sun, Apr 13, 2008 at 7:49 PM, Mathias Gaunard <mathias.gaunard@ens-lyon.org> wrote:
I would be quite interested in an utility that could generate a single functor with multiple overloads from multiple functors.
Please check my overload library overload_26_3_2008.zip in boost vault. If the user interface is what you need then there is a good news: I've developed a new version customized for Dean dispatcher that uses boost.function instead of the simple home grown one included in the above file. What actually I have almost ready it's an extension of boost.function that we could call "Multi-signature boost.function" that does what you would expect from the name including assignement from a boost.function object. Code is still not public (sent only to Dean), but if you are interested I can drop you an email with the attachment. Regards Marco
participants (3)
-
Marco Costalba
-
Mathias Gaunard
-
shunsuke