Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] Phoenix3 port to proto complete
From: alfC (alfredo.correa_at_[hidden])
Date: 2010-07-23 18:20:56

On Jul 23, 2:31 pm, Ahmed Charles <ahmedchar..._at_[hidden]> wrote:
> > std::bind and boost::bind are both monomorphic. phoenix::bind is
> > polymorphic!
> Would you (or anyone else) mind explaining polymorphic vs monomorphic in
> this context? Or point to an explanation?

It took me a while to understand it too. Basically when you bind a
function that is originally (statically) polymorphic, you only do it
for one of the overloads at a time, that is the bind object is not
For example if you have the free functions:
double square(double x){return x*x;}
int square(int x){return x*x;}
and you want to create a boost::lambda::bind from it, you have to
choose one of the two overloads first, even if it makes sense to
"keep" the two overloads in the bind.

phoenix functions work differently and therefore can keep both
overloads, which makes a lot of sense.

I am sure others will explain it better.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at