Boost logo

Boost :

Subject: Re: [boost] [bind] Function call operator is a template?!
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-12-16 18:56:48


On Wed, Dec 16, 2009 at 3:56 PM, Mathias Gaunard
<mathias.gaunard_at_[hidden]> wrote:
> Andy Venikov a écrit :
>
>> I'm not going to debate whether it's right or wrong, but I'm still curious
>> - why did it have to be a template? When bind() is called it already has all
>> the information about the function's signature
>
> Not in the general case.
> For function pointers or member function pointers, I suppose it is the case
> though.

struct myFunction
{
    int operator()(char c, int i){...}
    int operator()(char c, std::string s){...}
    int operator()(char c, float f){...}
}

auto b = bind(myFunction, 42, _1);

See why the template is useful now?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk