Overload-mrcec is a project mainly written in ..., it's free.
BOOST OVERLOAD (updated 2007/10/28)
================================================================= Copyright (c) 2007 Marco Cecchetti
Boost Overload behaves as an overloaded Boost Function. Actually it wraps multiple Boost Function objects of different signatures.
http://docs.google.com/View?docid=dhd386mp_16gxsfxn
http://docs.google.com/Doc?id=dfxvjncs_1x6456m
tested with boost version: 1.33.1, 1.34.1
gcc 4.1.2 under Linux pass intel 9.1 under Linux pass mingw 3.4.2 under Windows pass mingw 3.2.3 under Windows fail MS VC++ 8.0 under Windows pass MS VC++ 7.1 under Windows partial*
*all test passed but signature deduction of multi-signature function objects you have to use the signature based syntax with them.
added partial support for MSVC 7.1, all work but signature deduction of multi-signature function objects, you have to use the signature based syntax in order to set multi-signature function objects as callable targets;
you can set a free function overload or a member function overload as callable target through the signature based syntax for more info give a look to the new paragraph in the tuturial; the same applies to template free functions and template member functions;
added two new helper methods
in the folder libs/overload/example you can find all the examples presented in the tutorial;
fixed some minor issue.
tested with boost version: 1.33.1, 1.34.1
gcc 4.1.2 under Linux pass intel 9.1 under Linux pass mingw 3.4.2 under Windows pass mingw 3.2.3 under Windows fail MS VC++ 8.0 under Windows pass MS VC++ 7.1 under Windows fail
I went on working on the second implementation only. The source code has gone through refactoring and modularization. The signature deduction policy used by the "set" method is changed in the part concerned with multi-signature function objects. This is a complete and detailed description of the signature deduction policy:
Let be "ov" an instantiation of the template class overload for a given set of signatures "ss" used as template arguments:
tested on gcc 4.1.2 under Linux
The archive includes two implementations.
in the first implementation, I deduce function object signature by exploiting template function argument deduction; if the signature is not discovered no error is reported, and error handling is demanded to boost::function at call time; signature deduction of multi-signature function objects cause an "unresolved overloaded function type" compile error;
in the second implementation, if the signature is not deduced a compile time error is produced; signature deduction of multi-signature function objects is successfull if it exists one and only one signature registered in the overload that matches with the function object, else an ad-hoc compile time error, pointing out the ambiguity, is produced.