Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-10-01 18:09:39


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Jason House
>
> I want the result of the bound expression to have one input parameter
> that would be decided later. For instance:
>
> bool some_function(char x);
> boost::function<bool (char) some_function_object(some_function);
> boost::function<bool (int)> f = convert(some_function_object)
> std::cout << f(32);

I think what you're looking for is composition of functions? i.e. g o f
(x) => g(f(x))?

The right nomenclature might help... What it seems you want to do is to
generate a function that does this:

bool the_result(int i)
{
        return some_function(convert_to_char(int));
}

Is that right?

I know you can curry with boost function + lambda but I haven't tried
composition myself (though it should be possible!)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net