Subject: Re: [boost] An analogue of boost.function with multiple signatures
From: Marco (mrcekets_at_[hidden])
Date: 2009-03-05 19:35:14
you can find two implementations of multi functions in the boost vault
msf-1.2.2.zip by Marco Costalba
overload-mrcec/overload-0.3.0.zip by me
About the last one you can read a tutorial here:
(1) I don't know if they can interoperate with boost::lamba,
you should give it a try.
Using my implementation you can get what you're interested in
with the following code:
template< typename T>
T operator() (const T& x)
return x + x;
boost::overload< std::string (std::string),
(2) they are not extensions of boost function but separate libraries.
On Fri, 06 Mar 2009 00:44:23 +0100, JiÃ¸Ã PaleÃ¨ek <jpalecek_at_[hidden]> wrote:
> I'd like to have an object similar to boost::function, but with multiple
> function signatures. Eg. something like that
> multifunction<std::string(std::string), float(float),
> unsigned(unsigned)> mf;
> mf=_1 + _1; // I mean boost::lambda::_1
> mf("ab"); // should be "abab"
> mf((UINT_MAX/2)+1); // should be 0
> mf((UINT_MAX/2)+1.0); // should be UINT_MAX+1.0
> Would it be possible/feasible to change boost::function to allow this (as
> opposed to implementing it separately from boost::function)? Was
> something like this even proposed before (I vaguely recall something,
> but couldn't
> google anything useful, so I may be wrong)?
> Jiri Palecek
-- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk