|
Boost : |
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2008-07-02 06:29:58
On Wed, Jul 2, 2008 at 4:12 AM, Joel de Guzman
<joel_at_[hidden]> wrote:
>>
>> Giovanni Piero Deretta wrote:
>>> - Last time I checked Phoenix only had a monomoprhic bind. If you have
>>> polymorphic functions you have to convert them to lazy functions. I
>>> think that adding a polymorphic bind (like lambda shouldn't be hard).
>
> Boost.Lambda has polymorphic bind? How can it do that? Bind is
> inherently monomorphic. What am I missing?
>
Uh? Even C++0x bind is polymorphic:
struct plus_t {
template<class A, class B>
[] operator()(A a, B b) -> decltype(a + b) { return a + b; }
};
auto plus = std::bind(plus_t(), _1, _2);
int a = plus(1, 2);
std::string b = plus(std::string("hello"), std::string("world"));
With appropriate 'sig' magic in plus_t you can do the same thing with
boost.lambda (but not with boost.bind). Or we are talking about
different kind of polymorphism?
-- gpd
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk