Boost logo

Boost :

Subject: Re: [boost] [General] A standard idiom or technique?
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-10-24 07:53:21


Robert Jones wrote:
> On Fri, Oct 24, 2008 at 9:59 AM, Stjepan Rajko <stipe_at_[hidden]> wrote:
>
>> The following page seems to have a related example:
>> http://www.boost.org/doc/libs/1_36_0/libs/iterator/doc/zip_iterator.html
>>
>> Is that what you were looking for?
>>
>>
> Yep, that's what I was looking for! Spot-on, I can see this has already
> been done. Another great idea bites the dust - I'm too late as usual!

What would be useful is a generic function object whose argument is the
tuple from above and can forward to a supplied function whose arguments
are the individual values from the tuple.

Something that keeps me from littering my code with custom functions ala:

void existing_function(const T1&, const T2&, const T3&);

struct tuple_adaptation_of_existing_function
{
    void operator()(const tuple<T1, T2, T3>& t) const
    {
       existing_function(get<0>(t), get<1>(t), get<2>(t));
    }
};

Jeff


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