Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-11-02 03:36:34


Thorsten Schuett wrote:
> On Tuesday 01 November 2005 20:11, Peter Dimov wrote:
> [snip]
>
>>>However, the active lambda stuff could possibly be done as an
>>>extension of Boost.Lambda using Spirit/Phoenix sugar:
>>>
>>> future< int > = active<>[ _1 = _1 + 2 ];
>>
>>This doesn't work; your active<> doesn't take any arguments, so you can't
>>use _1. It is possible to make this:
>>
>>future<int> f1 = active( bind( f, 1, 2 ) );
>>future<int> f2 = active( bind( &X::f, &x, 1, 2 ) );
>
> What is the point of adding the active-Wrapper? The bind already returns a
> nullary function.
>
> future<int> f1 = bind( f, 1, 2 );
>
> should be sufficient.
>
> Just wondering.

I suppose you could make future take a bind/function and then make that
run on a thread. One of Herb's points was that you could grep for
*active* to find the places where you gain concurrency and for *wait*
where you lose it. For example:

    future< int > val = active { ... } // gain concurrency
    // ...
    std::cout << "value = " << val.wait(); // lose concurrency

- Reece


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